1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
|
PREFIX ?= $(HOME)/libraries
TESTDIR = tests
OBJDIR = obj
LIBDIR = lib
PKGCONF = `pkg-config --cflags --libs dbus-glib-1`
TESTBIN = $(OBJDIR)/tests/rebounder
TESTPID = `pidof rebounder`
MAJOR = 0
MINOR = 6
REV = 3
VERSION = $(MAJOR).$(MINOR).$(REV)
# Set VERSION to '' for a static library.
DBUSADA = libdbusada-$(VERSION)
TARBALL = $(DBUSADA).tar.bz2
NUM_CPUS ?= 1
# GNAT_BUILDER_FLAGS, ADAFLAGS and LDFLAGS may be overridden in the
# environment or on the command line.
GNAT_BUILDER_FLAGS ?= -R -j$(NUM_CPUS)
# GMAKE_OPTS should not be overridden because -p is essential.
GMAKE_OPTS = -p ${GNAT_BUILDER_FLAGS} \
$(foreach v,ADAFLAGS LDFLAGS,"-X$(v)=$($(v))")
# This variable explicitly exists for override by people with a
# different directory hierarchy.
# exec is unrelated and currently only used by tests
GPRINSTALLFLAGS := \
--prefix=$(PREFIX) \
--no-manifest \
--exec-subdir=tests \
--ali-subdir=lib/dbus-ada \
--lib-subdir=lib \
--project-subdir=lib/gnat \
--sources-subdir=include/dbus-ada \
# EOL
all: build-lib
build-lib:
gprbuild $(GMAKE_OPTS) -Pdbusada -XVERSION=$(VERSION)
build-tests:
gprbuild $(GMAKE_OPTS) -Pd_bus_ada_tests -XVERSION=
build-examples:
gprbuild $(GMAKE_OPTS) -Pd_bus_ada_examples -XVERSION=
install: build-lib
gprinstall -f -p -Pdbusada -XVERSION=$(VERSION) $(GPRINSTALLFLAGS)
tests: build-tests $(TESTBIN)
@$(TESTBIN) &
@$(OBJDIR)/tests/runner || true
@kill $(TESTPID)
$(OBJDIR)/tests:
@mkdir -p $@
$(TESTBIN): $(TESTDIR)/c/dbus-rebound.c | $(OBJDIR)/tests
$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(PKGCONF) $(LDLIBS)
clean:
@rm -rf $(OBJDIR)
@rm -rf $(LIBDIR)
dist:
@echo "Creating release tarball $(TARBALL) ... "
@git archive --format=tar HEAD --prefix $(DBUSADA)/ | bzip2 > $(TARBALL)
.PHONY: tests
include doc/doc.mk
|