Skip to content

Commit

Permalink
Adds fix for frontend.c and test Makefile template
Browse files Browse the repository at this point in the history
  • Loading branch information
Alomir committed Jan 9, 2025
1 parent e9ed8b0 commit 0d8d16c
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
2 changes: 1 addition & 1 deletion frontend.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,9 @@ int main(int argc, char *argv[]) {
strcat(climFile, ".clim");
numLocs = initModel(&spatialParams, &steps, paramFile, climFile);

#if EVENT_HANDLER
strcpy(eventFile, fileName);
strcat(eventFile, ".event");
#if EVENT_HANDLER
initEvents(eventFile, numLocs);
#endif

Expand Down
34 changes: 34 additions & 0 deletions tests/Makefile.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
CC=gcc
LD=gcc
CFLAGS=-Wall -g
LDFLAGS=-L../../..
LDLIBS=-lsipnet -lm

# List test files in this directory here
TEST_CFILES=<c files in this directory containing tests> <<== CHANGE THIS

# The rest is boilerplate, likely copyable as is to a new test directory
TEST_OBJ_FILES=$(TEST_CFILES:%.c=%.o)
TEST_EXECUTABLES:=$(basename $(TEST_CFILES))
RUN_EXECUTABLES:= $(addsuffix .run, $(TEST_EXECUTABLES))

all: tests

tests: $(TEST_EXECUTABLES)

$(TEST_EXECUTABLES): %: %.o
$(CC) $(LDFLAGS) $< $(LDLIBS) -o $@

$(TEST_OBJ_FILES): ../utils.h ../../../libsipnet.a ../exitHandler.c
$(TEST_OBJ_FILES): %.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<

run: $(RUN_EXECUTABLES)

$(RUN_EXECUTABLES):
./$(basename $@)

clean:
rm -f $(TEST_OBJ_FILES) $(TEST_EXECUTABLES) events.in

.PHONY: all tests clean run $(RUN_EXECUTABLES)

0 comments on commit 0d8d16c

Please sign in to comment.