Skip to content

Commit 0d8d16c

Browse files
committed
Adds fix for frontend.c and test Makefile template
1 parent e9ed8b0 commit 0d8d16c

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

frontend.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,9 @@ int main(int argc, char *argv[]) {
156156
strcat(climFile, ".clim");
157157
numLocs = initModel(&spatialParams, &steps, paramFile, climFile);
158158

159+
#if EVENT_HANDLER
159160
strcpy(eventFile, fileName);
160161
strcat(eventFile, ".event");
161-
#if EVENT_HANDLER
162162
initEvents(eventFile, numLocs);
163163
#endif
164164

tests/Makefile.template

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
CC=gcc
2+
LD=gcc
3+
CFLAGS=-Wall -g
4+
LDFLAGS=-L../../..
5+
LDLIBS=-lsipnet -lm
6+
7+
# List test files in this directory here
8+
TEST_CFILES=<c files in this directory containing tests> <<== CHANGE THIS
9+
10+
# The rest is boilerplate, likely copyable as is to a new test directory
11+
TEST_OBJ_FILES=$(TEST_CFILES:%.c=%.o)
12+
TEST_EXECUTABLES:=$(basename $(TEST_CFILES))
13+
RUN_EXECUTABLES:= $(addsuffix .run, $(TEST_EXECUTABLES))
14+
15+
all: tests
16+
17+
tests: $(TEST_EXECUTABLES)
18+
19+
$(TEST_EXECUTABLES): %: %.o
20+
$(CC) $(LDFLAGS) $< $(LDLIBS) -o $@
21+
22+
$(TEST_OBJ_FILES): ../utils.h ../../../libsipnet.a ../exitHandler.c
23+
$(TEST_OBJ_FILES): %.o: %.c
24+
$(CC) $(CFLAGS) -c -o $@ $<
25+
26+
run: $(RUN_EXECUTABLES)
27+
28+
$(RUN_EXECUTABLES):
29+
./$(basename $@)
30+
31+
clean:
32+
rm -f $(TEST_OBJ_FILES) $(TEST_EXECUTABLES) events.in
33+
34+
.PHONY: all tests clean run $(RUN_EXECUTABLES)

0 commit comments

Comments
 (0)