From 2ca0aa7c3415bd20d1804d9ab835267d604963e6 Mon Sep 17 00:00:00 2001 From: Blady Date: Mon, 12 Dec 2022 21:38:55 +0100 Subject: [PATCH] Add few convenient makefile targets. --- Makefile | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 32b9c1d..4c526e7 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,3 @@ -GPRBUILD_FLAGS = -p -j0 PREFIX ?= /usr GPRDIR ?= $(PREFIX)/share/gpr LIBDIR ?= $(PREFIX)/lib @@ -7,6 +6,31 @@ INSTALL_INCLUDE_DIR ?= $(DESTDIR)$(PREFIX)/include/spawn INSTALL_LIBRARY_DIR ?= $(DESTDIR)$(LIBDIR) INSTALL_ALI_DIR ?= ${INSTALL_LIBRARY_DIR}/spawn +LIBRARY_TYPE ?= static +BUILD_MODE ?= prod +SPAWN_WARN_ERRORS ?= true + +TARGET := $(shell gcc -dumpmachine) +ifeq ($(strip $(findstring linux, $(TARGET))),linux) + OS=unix +else +ifeq ($(strip $(findstring mingw32, $(TARGET))),mingw32) + OS=Windows_NT +else +ifeq ($(strip $(findstring cygwin, $(TARGET))),cygwin) + OS=Windows_NT +else +ifeq ($(strip $(findstring darwin, $(TARGET))),darwin) + OS=osx +else + OS=unix +endif +endif +endif +endif + +GPRBUILD_FLAGS = -p -j0 -XBUILD_MODE=$(BUILD_MODE) -XSPAWN_WARN_ERRORS=$(SPAWN_WARN_ERRORS) -XLIBRARY_TYPE=$(LIBRARY_TYPE) -XOS=$(OS) + GPRINSTALL_FLAGS = --prefix=$(PREFIX) --sources-subdir=$(INSTALL_INCLUDE_DIR)\ --lib-subdir=$(INSTALL_ALI_DIR) --project-subdir=$(INSTALL_PROJECT_DIR)\ --link-lib-subdir=$(INSTALL_LIBRARY_DIR) @@ -19,15 +43,30 @@ endif all: gprbuild $(GPRBUILD_FLAGS) -P gnat/spawn.gpr + +spawn_glib: + gprbuild $(GPRBUILD_FLAGS) -P gnat/spawn_glib.gpr + +test: gprbuild $(GPRBUILD_FLAGS) -P gnat/spawn_tests.gpr + check: export LD_LIBRARY_PATH=.libs/spawn/relocatable; \ for TEST in ${SPAWN_TESTS}; do \ echo $$TEST; $$TEST; \ done +test_spawn_glib: + gprbuild $(GPRBUILD_FLAGS) -P gnat/spawn_glib_tests.gpr + install: gprinstall $(GPRINSTALL_FLAGS) -p -P gnat/spawn.gpr + +install_spawn_glib: + gprinstall $(GPRINSTALL_FLAGS) -p -P gnat/spawn_glib.gpr + clean: gprclean -q -P gnat/spawn.gpr +clean_spawn_glib: + gprclean -q -P gnat/spawn_glib.gpr