fix names, add shared make file

This commit is contained in:
Andreas Gieriet 2020-02-10 00:54:45 +01:00
parent 6921ec60be
commit 0cbc2bda70
5 changed files with 65 additions and 4 deletions

View File

@ -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 =

61
shared.mk Normal file
View File

@ -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)

View File

@ -1,5 +1,5 @@
# what to produce
TARGET := lib/libprogctest.a
TARGET := lib/libsnptest.a
# public headers
HEADERS := include/test_utils.h

View File

@ -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_

View File

@ -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