Only compile statically for c3po tests the same as other tests
[akaros.git] / tests / Makefrag
1 TESTS_DIR = tests
2
3 OBJDIRS += $(TESTS_DIR)
4
5 TESTS_CFLAGS += $(USER_CFLAGS)
6
7 ALL_TEST_FILES = $(shell ls $(TESTS_DIR)/*.c)
8
9 TESTS_LDLIBS := -lpthread -lparlib
10
11 TESTS_SRCS := $(ALL_TEST_FILES)
12
13 TESTS_EXECS  = $(patsubst $(TESTS_DIR)/%.c, \
14                            $(OBJDIR)/$(TESTS_DIR)/%, \
15                            $(TESTS_SRCS))
16
17 TESTS_LDDEPENDS := $(TESTS_DIR)/%.c 
18
19 include $(TESTS_DIR)/c3po/Makefrag
20 STATIC := $(findstring static,$(TESTS_CFLAGS))
21 $(OBJDIR)/$(TESTS_DIR)/%: $(TESTS_LDDEPENDS)
22         @echo + cc [TESTS] $<
23         @mkdir -p $(@D)
24         $(V)$(CC) $(TESTS_CFLAGS) -o $@ $(TESTS_LDFLAGS) \
25                   $< $(TESTS_LDLIBS)
26         @if [ "$(STATIC)" != "static" ]; then \
27                 $(OBJDUMP) -S $@ > $@.asm; \
28                 $(NM) -n $@ > $@.sym; \
29         fi
30
31 install-tests: $(TESTS_EXECS)
32         @echo + install [TESTS] $(firstword $(INITRAMFS_PATHS))/bin/
33         $(V)for i in "$(TESTS_EXECS)"; \
34         do \
35           cp $$i $(firstword $(INITRAMFS_PATHS))/bin/; \
36         done;