diff --git a/Doxyfile b/Doxyfile index 221b1c5..da6c3f6 100644 --- a/Doxyfile +++ b/Doxyfile @@ -4,7 +4,7 @@ # Project related configuration options #--------------------------------------------------------------------------- DOXYFILE_ENCODING = UTF-8 -PROJECT_NAME = "PROGC - Labs" +PROJECT_NAME = "SNP - Labs" PROJECT_NUMBER = PROJECT_BRIEF = PROJECT_LOGO = diff --git a/shared.mk b/shared.mk new file mode 100644 index 0000000..37e977c --- /dev/null +++ b/shared.mk @@ -0,0 +1,61 @@ +# minimal required settings +SNP_TESTLIB := $(if $(SNP_TESTLIB),$(SNP_TESTLIB),"SNP_TESTLIB-is-not-set") +SNP_DOXYFILE := $(if $(SNP_DOXYFILE),$(SNP_DOXYFILE),"SNP_DOXYFILE-is-not-set") + +# directories to create (and remove upon cleanup) +CREATEDIRS := bin doc + +# list of derived file names from the source names +OBJECTS := $(SOURCES:%.c=%.o) # list of gcc -c ... produced *.o files +DEPS := $(SOURCES:%.c=%.d) # list of gcc -MD ... produced *.d files +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 + +# shared libs +TSTLIBDIR := $(SNP_TESTLIB)/lib +TSTINCDIR := $(SNP_TESTLIB)/include + +# full path to the target +FULLTARGET := $(CURDIR)/$(TARGET) + +# commands and flags +CC = gcc +CFLAGS = -std=c99 -Wall -pedantic -g +CPPFLAGS = -MD -Isrc -Itests -I$(TSTINCDIR) -DTARGET=$(FULLTARGET) +LDFLAGS = + +# targets which get always visited (without checking any up-to-date state) +.PHONY: default clean test doc install mkdir + +# targets +default: $(FULLTARGET) + @echo "#### $< built ####" + +$(FULLTARGET): mkdir $(OBJECTS) Makefile + $(LINK.c) -o $@ $(OBJECTS) + +clean: + $(RM) $(TARGET) $(OBJECTS) $(DEPS) $(TSTTARGET) $(TSTOBJECTS) $(TSTDEPS) $(wildcard */*~ *~ tests/*.txt) + $(RM) -r $(CREATEDIRS) + @echo "#### $@ done ####" + +doc: + doxygen $(SNP_DOXYFILE) > /dev/null + @echo "#### $@ done ####" + +test: $(TSTTARGET) + (cd tests; $(TSTTARGET)) + @echo "#### $< executed ####" + +$(TSTTARGET): $(FULLTARGET) $(TSTOBJECTS) + $(LINK.c) -o $(TSTTARGET) $(TSTOBJECTS) $(FULLTARGET) -lcunit -L$(TSTLIBDIR) -lsnptest + @echo "#### $@ built ####" + + +# create needed directories (ignoring any error) +mkdir: + -mkdir -p $(CREATEDIRS) + +# read in the gcc -MD ... produced dependencies (ignoring any error) +-include $(DEPS) $(TSTDEPS) diff --git a/testlib/Makefile b/testlib/Makefile index 3e34f63..5706175 100755 --- a/testlib/Makefile +++ b/testlib/Makefile @@ -1,5 +1,5 @@ # what to produce -TARGET := lib/libprogctest.a +TARGET := lib/libsnptest.a # public headers HEADERS := include/test_utils.h diff --git a/testlib/include/test_utils.h b/testlib/include/test_utils.h index 99634f7..f076c1f 100644 --- a/testlib/include/test_utils.h +++ b/testlib/include/test_utils.h @@ -9,7 +9,7 @@ */ /** * @file - * @brief Common test utilities for writing PROGC tests. + * @brief Common test utilities for writing SNP tests. */ #ifndef _TEST_UTILS_H_ #define _TEST_UTILS_H_ diff --git a/testlib/tests/tests.c b/testlib/tests/tests.c index 894c072..0cb08eb 100644 --- a/testlib/tests/tests.c +++ b/testlib/tests/tests.c @@ -161,7 +161,7 @@ static void test_assert_lines_no_newline_at_the_end(void) */ int main(void) { - TestMainBasic("PROGC Test Lib", setup, teardown + TestMainBasic("SNP Test Lib", setup, teardown , test_remove_file_that_exists , test_remove_file_that_does_not_exist , test_assert_lines_empty_file