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
  27include $(TESTS_DIR)/openmp/Makefrag
  28include $(TESTS_DIR)/vmm/Makefrag
  29include $(TESTS_DIR)/dune/Makefrag
  30
  31TESTS_EXECS = $(TESTS_EXECS_C) $(TESTS_EXECS_CPP)
  32
  33STATIC := $(findstring static,$(CFLAGS_TESTS))
  34$(OBJDIR)/$(TESTS_DIR)/%: $(TESTS_LDDEPENDS_C)
  35        @echo + cc [TESTS] $<
  36        @mkdir -p $(@D)
  37        $(Q)$(CC) $(CFLAGS_TESTS) -o $@ $< $(TESTS_LDLIBS)
  38        @if [ "$(STATIC)" != "static" ]; then \
  39                $(OBJDUMP) -S $@ > $@.asm; \
  40                $(NM) -n $@ > $@.sym; \
  41        fi
  42
  43# Note that we don't disassemble CPPs by default, even if they aren't static.
  44# The files are pretty large regardless (9MB for a simple stream test asm).
  45$(OBJDIR)/$(TESTS_DIR)/%: $(TESTS_LDDEPENDS_CPP)
  46        @echo + cc [TESTS] $<
  47        @mkdir -p $(@D)
  48        $(Q)$(CPP) $(TESTS_CXXFLAGS) -o $@ $< $(TESTS_LDLIBS)
  49
  50all: $(TESTS_EXECS)
  51        @:
  52
  53install: $(TESTS_EXECS)
  54        @mkdir -p $(FIRST_KFS_PATH)/bin
  55        $(Q)cp -uP $^ $(FIRST_KFS_PATH)/bin
  56
  57uninstall:
  58        $(Q)rm -rf $(addprefix $(FIRST_KFS_PATH)/bin/, $(notdir $(TESTS_EXECS)))
  59
  60clean:
  61        @echo + clean [TESTS]
  62        @rm -rf $(OBJDIR)/tests/
  63
  64.PHONY: $(PHONY)
  65