| 1 |
CC ?= gcc |
| 2 |
CFLAGS = -g -Wall -pedantic |
| 3 |
|
| 4 |
ENABLE_TIMER ?= no |
| 5 |
|
| 6 |
ifeq '$(ENABLE_TIMER)' 'yes' |
| 7 |
CFLAGS += -DCU_ENABLE_TIMER |
| 8 |
endif |
| 9 |
|
| 10 |
TARGETS = libcu.a |
| 11 |
|
| 12 |
TEST_OBJS = test.o test2.o |
| 13 |
|
| 14 |
all: $(TARGETS) |
| 15 |
|
| 16 |
libcu.a: cu.o |
| 17 |
ar cr $@ $^ |
| 18 |
ranlib $@ |
| 19 |
cu.o: cu.c cu.h |
| 20 |
$(CC) $(CFLAGS) -c -o $@ $< |
| 21 |
|
| 22 |
test: $(TEST_OBJS) libcu.a |
| 23 |
$(CC) $(CFLAGS) -o $@ $(TEST_OBJS) -L./ -lcu |
| 24 |
test-segfault: test-segfault.c libcu.a |
| 25 |
$(CC) $(CFLAGS) -o $@ $^ -L./ -lcu |
| 26 |
|
| 27 |
%.o: %.c |
| 28 |
$(CC) $(CFLAGS) -c -o $@ $< |
| 29 |
|
| 30 |
check: test test-segfault |
| 31 |
mkdir -p regressions |
| 32 |
touch regressions/testSuiteName{,2}.{out,err} |
| 33 |
touch regressions/testSuiteTest2.{out,err} |
| 34 |
-./test |
| 35 |
-cd regressions && ../check-regressions |
| 36 |
@echo "" |
| 37 |
@echo "======= SEGFAULT: =========" |
| 38 |
@echo "" |
| 39 |
-./test-segfault |
| 40 |
|
| 41 |
clean: |
| 42 |
rm -f *.o |
| 43 |
rm -f test |
| 44 |
rm -f test-segfault |
| 45 |
rm -f $(TARGETS) |
| 46 |
rm -f tmp.* |
| 47 |
rm -rf regressions |
| 48 |
|
| 49 |
.PHONY: all clean check |