dstdir = bin
.PHONY: all run clean mrpropre mrpropre love debug doc man \
- test tests run-test run-tests run-test-more run-tests-more \
+ test run-test run-test-more \
mess-run mess-clean mess-propre mess-doc mess-man \
mess-test mess-run-test mess-run-test-more \
$(NAME) utils net check \
all: $(NAME)
# Sub makes:
+M_OPTS=$(MAKECMDGOALS) --no-print-directory PREFIX=$(PREFIX)
MK:
- @$(MAKE) -C src/$(NAME) $(MAKECMDGOALS) DEBUG=$(DEBUG)
+ @$(MAKE) -C src/$(NAME) $(M_OPTS) DEBUG=$(DEBUG)
MKTEST:
- @$(MAKE) -C src/tests $(MAKECMDGOALS) DEBUG=$(DEBUG)
+ @$(MAKE) -C src/tests $(M_OPTS) DEBUG=$(DEBUG)
MKMAN:
- @$(MAKE) -f man.d $(MAKECMDGOALS) NAME=$(NAME) PREFIX=$(PREFIX)
+ @$(MAKE) -f man.d $(M_OPTS) NAME=$(NAME)
# Main buildables
$(NAME): utils net check
@echo Nothing to run, this is a library
# Test + run test
-tests: test
test: mess-test MKTEST
-run-tests: run-test
run-test: mess-run-test MKTEST
-run-tests-more: run-test-more
run-test-more: mess-run-test-more MKTEST
# Doc/man/misc
love:
@echo " ...not war."
debug:
- $(MAKE) DEBUG=1
+ $(MAKE) $(M_OPTS) DEBUG=1
# Clean
clean: mess-clean MK MKTEST
@echo ">>>>>>>>>> Building tests for $(NAME)..."
mess-run-test:
@echo ">>>>>>>>>> Running tests on $(NAME)..."
- @echo
mess-run-test-more:
@echo ">>>>>>>>>> Running more tests on $(NAME)..."
- @echo
mess-install:
@echo ">>>>>>>>>> Installing $(NAME) into $(PREFIX)..."
mess-uninstall:
.PHONY: all install uninstall clean mrpropre mrpropre \
test run run-test run-test-more
+SOURCES=$(wildcard $(srcdir)/*.c)
+HEADERS=$(wildcard $(srcdir)/*.h)
+OBJECTS=$(SOURCES:%.c=%.o)
+
+################
+# Dependencies #
+################
+OBJECTS+=$(dstdir)/libcutils.o
+OBJECTS+=$(dstdir)/libcutils-check.o
+$(dstdir)/libcutils.o:
+ $(MAKE) --no-print-directory -C cutils/ utils
+$(dstdir)/libcutils-check.o:
+ $(MAKE) --no-print-directory -C cutils/ check
+################
+
all: test
test: $(dstdir)/tests
run: run-test
run-test: test
- $(dstdir)/tests
+ @echo
+ @$(dstdir)/tests
run-test-more: test
- $(dstdir)/tests --more
+ @echo
+ @$(dstdir)/tests --more
-SOURCES=$(wildcard $(srcdir)/*.c)
-HEADERS=$(wildcard $(srcdir)/*.h)
-OBJECTS=$(SOURCES:%.c=%.o)
-OBJECTS+=$($(dstdir)/libcutils.o)
-$(dstdir)/tests: $(OBJECTS) $(dstdir)/libcutils-check.o
+$(dstdir)/tests: $(OBJECTS)
mkdir -p $(dstdir)
- $(CC) $(CFLAGS) $(LDFLAGS) $(OBJECTS) $(dstdir)/libcutils-check.o -o $@
+ $(CC) $(CFLAGS) $(LDFLAGS) $(OBJECTS) -o $@
clean:
rm -f $(srcdir)/*.o