C templates GNUmakefile : cleanup and doc update
This commit is contained in:
@@ -9,46 +9,44 @@
|
|||||||
# code.
|
# code.
|
||||||
#
|
#
|
||||||
# To use this makefile (GNU make only):
|
# To use this makefile (GNU make only):
|
||||||
# "make": build with all predefined tests (without editing test source code)
|
# 1) copy it into exercise directory
|
||||||
# "make debugall": build with all predefined tests and debug code
|
# 2) add ex.h to exercise include file
|
||||||
# "make mem": perform memcheck with all tests enabled
|
# 3) add ex.c to exercise source code, and create a suitable main function
|
||||||
# "make unit": build standalone (unit) test
|
# 4) use make with one of the following targets :
|
||||||
# "make debug": build standalone test with debugging code
|
# all: compile and run all predefined tests.
|
||||||
|
# nowarn: compile with no -Wall and -Wextra, and run all predefined tests
|
||||||
|
# debug: compile with -DDEBUG and run all predefined tests
|
||||||
|
# mem: perform memcheck with all tests enabled
|
||||||
|
# unit: build standalone (unit) binary
|
||||||
|
# unitnowarn: build standalone binary with -Wall and -Wextra disabled
|
||||||
|
# unitdebug: build standalone binary with -DDEBUG
|
||||||
#
|
#
|
||||||
# Original 'makefile' targets can be used (test, memcheck, clean, ...)
|
# Original 'makefile' targets can be used (test, memcheck, clean, ...)
|
||||||
|
|
||||||
.PHONY: default all mem unit debug std debugtest
|
.PHONY: default all nowarn debug mem unitnowarn unitdebug unit
|
||||||
|
|
||||||
default: all
|
default: all
|
||||||
|
|
||||||
# default is to build with all predefined tests
|
|
||||||
BUILD := teststall
|
|
||||||
|
|
||||||
include makefile
|
include makefile
|
||||||
|
|
||||||
all: CFLAGS+=-DTESTALL
|
all: CFLAGS+=-DTESTALL
|
||||||
all: clean test
|
all: clean test
|
||||||
|
|
||||||
nowarn: CFLAGS:=$(filter-out -Wextra -Wall,$(CFLAGS))
|
nowarn: CFLAGS:=$(filter-out -Wextra -Wall,$(CFLAGS))
|
||||||
nowarn: clean test
|
nowarn: clean all
|
||||||
|
|
||||||
debugall: CFLAGS+=-DDEBUG
|
debug: CFLAGS+=-DDEBUG
|
||||||
debugall: all
|
debug: all
|
||||||
|
|
||||||
debugtest: CFLAGS+=-DDEBUG
|
|
||||||
debugtest: test
|
|
||||||
|
|
||||||
mem: CFLAGS+=-DTESTALL
|
mem: CFLAGS+=-DTESTALL
|
||||||
mem: clean memcheck
|
mem: clean memcheck
|
||||||
|
|
||||||
|
unitnowarn: CFLAGS:=$(filter-out -Wextra -Wall,$(CFLAGS))
|
||||||
|
unitnowarn: clean unit
|
||||||
|
|
||||||
|
unitdebug: CFLAGS+=-DDEBUG
|
||||||
|
unitdebug: clean unit
|
||||||
|
|
||||||
unit: CFLAGS+=-DUNIT_TEST
|
unit: CFLAGS+=-DUNIT_TEST
|
||||||
unit: clean std
|
unit: src/*.c src/*.h
|
||||||
|
|
||||||
debug: CFLAGS+=-DUNIT_TEST -DDEBUG
|
|
||||||
debug: clean std
|
|
||||||
|
|
||||||
debugtest: CFLAGS+=-DDEBUG
|
|
||||||
debugtest: test
|
|
||||||
|
|
||||||
std: src/*.c src/*.h
|
|
||||||
$(CC) $(CFLAGS) src/*.c -o tests.out $(LIBS)
|
$(CC) $(CFLAGS) src/*.c -o tests.out $(LIBS)
|
||||||
|
Reference in New Issue
Block a user