publish testlib and doxygen shared configuration

This commit is contained in:
Andreas Gieriet
2020-02-10 00:11:44 +01:00
parent c3f83f6315
commit 6921ec60be
7 changed files with 568 additions and 224 deletions
Regular → Executable
+11 -18
View File
@@ -1,8 +1,8 @@
# what to produce
TARGET := bin/libprogctest.a
TARGET := lib/libprogctest.a
# public headers
HEADERS := src/test_utils.h
HEADERS := include/test_utils.h
# implementation files
SOURCES := src/test_utils.c
@@ -11,7 +11,7 @@ SOURCES := src/test_utils.c
TSTSOURCES := tests/tests.c
# directories to create (and remove upon cleanup)
CREATEDIRS := bin doc
CREATEDIRS := lib doc
# list of derived file names from the source names
OBJECTS := $(SOURCES:%.c=%.o) # list of gcc -c ... produced *.o files
@@ -20,22 +20,14 @@ TSTOBJECTS := $(TSTSOURCES:%.c=%.o) # list of gcc -c ... produced *.o files
TSTDEPS := $(TSTSOURCES:%.c=%.d) # list of gcc -MD ... produced *.d files
TSTTARGET := $(CURDIR)/tests/runtest
# libraries
CUNITINCDIR := $(CURDIR)/../CUnit/include
CUNITLIBDIR := $(CURDIR)/../CUnit/lib
# where to install the static library and the associated headers
INSTALLLIBDIR := $(CURDIR)/../lib
INSTALLINCDIR := $(CURDIR)/../include
# full path to the target
FULLTARGET := $(CURDIR)/$(TARGET)
# commands and flags
CC = gcc
CFLAGS = -std=c99 -Wall -g
CPPFLAGS = -MD -Isrc -Itests -I$(INSTALLINCDIR) -I$(CUNITINCDIR) -DTARGET=$(FULLTARGET)
LDFLAGS = -static -z muldefs
CFLAGS = -std=c99 -Wall -pedantic -g
CPPFLAGS = -MD -Isrc -Itests -Iinclude -DTARGET=$(FULLTARGET)
LDFLAGS =
ARFLAGS = rc
# targets which get always visited (without checking any up-to-date state)
@@ -54,17 +46,18 @@ clean:
@echo "#### $@ done ####"
install: $(FULLTARGET)
mkdir -p $(INSTALLLIBDIR) $(INSTALLINCDIR)
cp -f $(FULLTARGET) $(INSTALLLIBDIR)/
cp -f $(HEADERS) $(INSTALLINCDIR)/
@echo "#### $< installed ####"
doc:
doxygen ../Doxyfile > /dev/null
@echo "#### $@ done ####"
test: $(TSTTARGET)
(cd tests; $(TSTTARGET))
@echo "#### $< executed ####"
$(TSTTARGET): $(FULLTARGET) $(TSTOBJECTS)
$(LINK.c) -o $(TSTTARGET) $(TSTOBJECTS) $(FULLTARGET) -L$(CUNITLIBDIR) -lcunit
$(LINK.c) -o $(TSTTARGET) $(TSTOBJECTS) $(FULLTARGET) -lcunit
@echo "#### $@ built ####"