2020-06-23 10:00:05 +00:00
|
|
|
PROJECT_ROOT= ../..
|
|
|
|
include $(PROJECT_ROOT)/Mk/main.mk
|
|
|
|
|
|
|
|
ifndef SRCDIR
|
|
|
|
$(error SRCDIR not defined)
|
|
|
|
endif
|
2020-03-31 12:59:53 +00:00
|
|
|
|
2020-03-28 18:37:11 +00:00
|
|
|
SRCS:= $(wildcard *.t.c)
|
|
|
|
OBJS:= $(SRCS:.t.c=.t.o)
|
|
|
|
|
2020-06-23 10:00:05 +00:00
|
|
|
SRCSRCS:= $(wildcard $(PROJECT_ROOT)/$(SRCDIR)/*.c)
|
|
|
|
SRCHDRS:= $(wildcard $(PROJECT_ROOT)/$(SRCDIR)/*.h)
|
2020-03-28 18:37:11 +00:00
|
|
|
SRCSOBJS:= $(SRCSRCS:.c=.o)
|
2020-06-23 10:00:05 +00:00
|
|
|
OBJS+= $(filter-out $(PROJECT_ROOT)/$(SRCDIR)/main.o,$(SRCSOBJS))
|
|
|
|
MKFS:= $(wildcard GNUmakefile $(PROJECT_ROOT)/$(SRCDIR)/GNUmakefile $(PROJECT_ROOT)/GNUmakefile $(PROJECT_ROOT)/Mk/*.mk)
|
2020-03-28 18:37:11 +00:00
|
|
|
|
|
|
|
all: test
|
|
|
|
|
|
|
|
$(TARGET).test: $(OBJS)
|
|
|
|
$(CC) $(LDFLAGS) $(TPKG_LDFLAGS) -o $@ $^ $(LIBS) $(TPKG_LIBS)
|
|
|
|
|
|
|
|
%.t.o: %.t.c $(SRCHDRS) $(MKFS)
|
|
|
|
ifdef CHECK_MISSING
|
|
|
|
$(error unit test dependency 'check' not found; \
|
|
|
|
install it or point CHECK_BASE to base path)
|
|
|
|
endif
|
|
|
|
$(CC) -c $(CPPFLAGS) $(TCPPFLAGS) $(CFLAGS) $(TPKG_CFLAGS) -o $@ \
|
|
|
|
-x c $<
|
|
|
|
|
|
|
|
buildtest: TCPPFLAGS+=-D"TEST_ZEROUSR=\"$(shell id -u -n root||echo 0)\""
|
|
|
|
buildtest: TCPPFLAGS+=-D"TEST_ZEROGRP=\"$(shell id -g -n root||echo 0)\""
|
2020-06-23 10:00:05 +00:00
|
|
|
buildtest: TCPPFLAGS+=-I$(PROJECT_ROOT)/$(SRCDIR)
|
2020-03-28 18:37:11 +00:00
|
|
|
buildtest: $(TARGET).test
|
|
|
|
$(MAKE) -C engine
|
|
|
|
$(MAKE) -C pki testreqs
|
|
|
|
|
|
|
|
test: buildtest
|
|
|
|
./$(TARGET).test
|
|
|
|
|
|
|
|
sudotest: buildtest
|
|
|
|
sudo ./$(TARGET).test
|
|
|
|
|
2020-03-31 12:59:53 +00:00
|
|
|
travis: TCPPFLAGS+=-DTRAVIS
|
2020-03-28 18:37:11 +00:00
|
|
|
travis: test
|
|
|
|
|
|
|
|
clean:
|
|
|
|
$(MAKE) -C engine clean
|
|
|
|
$(RM) -f $(TARGET).test *.o .*.o *.core *~
|
|
|
|
$(RM) -rf *.dSYM
|
|
|
|
|
|
|
|
ifdef GITDIR
|
|
|
|
lint:
|
|
|
|
$(CPPCHECK) $(CPPCHECKFLAGS) --force --enable=all --error-exitcode=1 .
|
|
|
|
|
|
|
|
realclean: clean
|
|
|
|
$(MAKE) -C pki clean
|
|
|
|
endif
|
|
|
|
|
|
|
|
FORCE:
|
|
|
|
|
|
|
|
.PHONY: all config clean buildtest test sudotest travis realclean
|
|
|
|
|