Skip to content
Permalink
Browse files

fix names, add shared make file

  • Loading branch information
giei committed Feb 9, 2020
1 parent 6921ec6 commit 0cbc2bda70e36cbe70aab0a8c6c88d426953e774
Showing with 65 additions and 4 deletions.
  1. +1 −1 Doxyfile
  2. +61 −0 shared.mk
  3. +1 −1 testlib/Makefile
  4. +1 −1 testlib/include/test_utils.h
  5. +1 −1 testlib/tests/tests.c
@@ -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 =
@@ -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)
@@ -1,5 +1,5 @@
# what to produce
TARGET := lib/libprogctest.a
TARGET := lib/libsnptest.a

# public headers
HEADERS := 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_
@@ -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

0 comments on commit 0cbc2bd

Please sign in to comment.
You can’t perform that action at this time.