akaros/tests/Makefile
<<
>>
Prefs
   1# Default target is to just make
   2PHONY += all install uninstall clean
   3all:
   4
   5# TODO: when we clean this up, if we ditch OBJDIR, change the root makefile
   6TESTS_DIR = tests
   7
   8CFLAGS_TESTS += $(CFLAGS_USER) -g
   9TESTS_CXXFLAGS += $(CXXFLAGS_USER) -g -std=gnu++11
  10
  11TESTS_LDLIBS := -lpthread -lvmm -lbenchutil -lm -lndblib -liplib
  12
  13TESTS_SRCS_C := $(wildcard $(TESTS_DIR)/*.c)
  14TESTS_SRCS_CPP := $(wildcard $(TESTS_DIR)/*.cc)
  15
  16TESTS_LDDEPENDS_C := $(TESTS_DIR)/%.c 
  17TESTS_LDDEPENDS_CPP := $(TESTS_DIR)/%.cc
  18
  19TESTS_EXECS_C  = $(patsubst $(TESTS_DIR)/%.c, \
  20                            $(OBJDIR)/$(TESTS_DIR)/%, \
  21                            $(TESTS_SRCS_C))
  22
  23TESTS_EXECS_CPP  = $(patsubst $(TESTS_DIR)/%.cc, \
  24                              $(OBJDIR)/$(TESTS_DIR)/%, \
  25                              $(TESTS_SRCS_CPP))
  26
  27export TESTS_DIR OBJDIR
  28
  29include $(TESTS_DIR)/openmp/Makefrag
  30include $(TESTS_DIR)/vmm/Makefrag
  31include $(TESTS_DIR)/dune/Makefrag
  32
  33TESTS_EXECS = $(TESTS_EXECS_C) $(TESTS_EXECS_CPP)
  34
  35STATIC := $(findstring static,$(CFLAGS_TESTS))
  36$(OBJDIR)/$(TESTS_DIR)/%: $(TESTS_LDDEPENDS_C)
  37        @echo + cc [TESTS] $<
  38        @mkdir -p $(@D)
  39        $(Q)$(CC) $(CFLAGS_TESTS) -o $@ $< $(TESTS_LDLIBS)
  40        @if [ "$(STATIC)" != "static" ]; then \
  41                $(OBJDUMP) -S $@ > $@.asm; \
  42                $(NM) -n $@ > $@.sym; \
  43        fi
  44
  45# Note that we don't disassemble CPPs by default, even if they aren't static.
  46# The files are pretty large regardless (9MB for a simple stream test asm).
  47$(OBJDIR)/$(TESTS_DIR)/%: $(TESTS_LDDEPENDS_CPP)
  48        @echo + cc [TESTS] $<
  49        @mkdir -p $(@D)
  50        $(Q)$(CPP) $(TESTS_CXXFLAGS) -o $@ $< $(TESTS_LDLIBS)
  51
  52all: $(TESTS_EXECS)
  53        @cd $(TESTS_DIR)/linux && $(MAKE)
  54
  55install: $(TESTS_EXECS)
  56        @mkdir -p $(FIRST_KFS_PATH)/bin
  57        $(Q)cp -uP $^ $(FIRST_KFS_PATH)/bin
  58
  59uninstall:
  60        $(Q)rm -rf $(addprefix $(FIRST_KFS_PATH)/bin/, $(notdir $(TESTS_EXECS)))
  61
  62clean:
  63        @echo + clean [TESTS]
  64        @rm -rf $(OBJDIR)/tests/
  65        @cd $(TESTS_DIR)/linux && $(MAKE) clean
  66
  67.PHONY: $(PHONY)
  68