Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add few convenient makefile targets. #31

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 40 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
GPRBUILD_FLAGS = -p -j0
PREFIX ?= /usr
GPRDIR ?= $(PREFIX)/share/gpr
LIBDIR ?= $(PREFIX)/lib
Expand All @@ -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)
Expand All @@ -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