diff options
| author | Alexander M Pickering <alex@cogarr.net> | 2021-12-17 15:18:56 -0600 |
|---|---|---|
| committer | Alexander M Pickering <alex@cogarr.net> | 2021-12-17 15:18:56 -0600 |
| commit | 5d4044ca0f92efbcb7f5c395bc75909910aef120 (patch) | |
| tree | 9b819c11c96e077beb782673eb773c3a49f0b52b | |
| parent | 9eba038c615e872fa3f4f8167a7979d367c26661 (diff) | |
| download | libctemplates-5d4044ca0f92efbcb7f5c395bc75909910aef120.tar.gz libctemplates-5d4044ca0f92efbcb7f5c395bc75909910aef120.tar.bz2 libctemplates-5d4044ca0f92efbcb7f5c395bc75909910aef120.zip | |
Modified includes
| -rw-r--r-- | Makefile | 31 | ||||
| -rw-r--r-- | include/ctemplates.h | 2 | ||||
| -rw-r--r-- | t/test_1.c | 2 |
3 files changed, 14 insertions, 21 deletions
@@ -1,4 +1,4 @@ -CFLAGS = -Isrc/ -L. -std=c99 -pedantic +CFLAGS+= -Isrc/ -L. -std=c99 -pedantic CC?=gcc LIBNAME = libctemplates.a BIN_POSTFIX = .exe @@ -13,13 +13,10 @@ objs = ctemplates fbuf hashmap kmp lexer objfiles = $(objs:%=build/%.o) -TEST_1_NAME = t/test_1$(BIN_POSTFIX) -TEST_2_NAME = t/test_2$(BIN_POSTFIX) -TEST_3_NAME = t/test_3$(BIN_POSTFIX) +test_srcs = $(wildcard t/*.c) +test_objs = $(test_srcs:%.c=%.o) +test_bins = $(test_srcs:%.c=%) -examples=hello variable -example_bins=$(examples:%=examples/%$(BIN_POSTFIX)) -example_objs=$(examples:%=examples/%.o) $(LIBNAME): $(objfiles) ar rc $@ $^ @@ -31,22 +28,20 @@ $(objfiles) : build/%.o : src/%.c src/%.h clean: $(RM) build/*.o *.a $(LIBNAME) -$(TEST_1_NAME): t/test_1.c $(LIBNAME) - $(CC) $(CFLAGS) -o $@ $< -lctemplates +test: $(test_bins) + ./test_1.exe + ./test_2.exe + ./test_3.ext -$(TEST_2_NAME): t/test_2.c $(LIBNAME) - $(CC) $(CFLAGS) -o $@ $< -lctemplates +$(test_bins) : % : %.o + $(CC) -Iinclude/ -o $@ $< libctemplates.a -$(TEST_3_NAME): t/test_3.c $(LIBNAME) - $(CC) $(CFLAGS) -o $@ $< -lctemplates - -test: $(TEST_1_NAME) $(TEST_2_NAME) $(TEST_3_NAME) - #$(TEST_1_NAME) - #$(TEST_2_NAME) - $(TEST_3_NAME) +$(test_objs) : %.o : %.c $(LIBNAME) + $(CC) -Iinclude/ -o $@ -c $< examples: $(example_bins) $(example_bins) + $(example_bins): %$(BIN_POSTFIX) : %.o $(CC) $(CFLAGS) -o $@ $< -lctemplates diff --git a/include/ctemplates.h b/include/ctemplates.h index e0598ad..1aa79ba 100644 --- a/include/ctemplates.h +++ b/include/ctemplates.h @@ -10,8 +10,6 @@ * of the GNU General Public License (GPL) */ -#include <stddef.h> - #ifndef _CTEMPLATE_H #define _CTEMPLATE_H @@ -4,7 +4,7 @@ */ #include <stdio.h> - +#include <string.h> #include <ctemplates.h> char t_1[] = "This is a <TMPL_VAR name=\"what\">!"; |
