Fix possibly undefined values
[libisds.git] / test / Makefile
blobed7229d42200a39e3d9fab65d9d1417bc061a401
1 include ../src/Makefile.inc
2 CFLAGS += -I../src
3 OBJS := $(wildcard ../src/*.o)
4 SRCS := $(wildcard *.c)
5 TESTS := $(SRCS:%.c=%.test)
7 %.o: %.c test.h
8 $(CC) $(CFLAGS) $< -c -o $@
10 # First specific tests
11 isds-%.test: isds-%.o
12 $(CC) $(LDFLAGS) $< $(filter-out ../src/isds.o,$(OBJS)) -o $@
14 # Then generic rule. Order is important.
15 %.test: %.o
16 $(CC) $(LDFLAGS) $< $(OBJS) -o $@
18 all: $(TESTS)
20 test: $(TESTS)
21 @FAILED=0; \
22 for T in $^; do "./$$T" || FAILED=$$((FAILED+1)); done; \
23 if [ "$$FAILED" -gt "0" ]; then \
24 UNIT="unit tests"; \
25 test "$$FAILED" == "1" && UNIT="unit test"; \
26 echo "*** $$FAILED $$UNIT failed. Please tell developers about it."; \
27 echo "Your report can make this world better!"; \
28 echo "*** Environment info:"; \
29 echo "Platform: $$(uname -msr)"; \
30 echo "CFLAGS: $(CFLAGS)"; \
31 echo "LDFLAGS: $(LDFLAGS)"; \
32 echo "Compiler: $$($(CC) --version)"; \
33 echo "libxml: $$(pkg-config --modversion libxml-2.0)"; \
34 echo "libcurl: $$(pkg-config --modversion libcurl)"; \
35 echo "libcrypt: $$(libgcrypt-config --version)"; \
36 echo "ksba: $$(ksba-config --version)"; \
37 echo "gpgme: $$(gpgme-config --version)"; \
38 exit 1; \
39 else \
40 echo "*** All tests passed. Today's your lucky day :)"; \
41 exit 0; \
44 clean:
45 -rm *.test *.o