Changes in uspace/Makefile.common [7e69e0e:a047aaa] in mainline


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/Makefile.common

    r7e69e0e ra047aaa  
    7878        JOB = $(BINARY).job
    7979        OUTPUT = $(BINARY)
     80        TEST_BINARY = test-$(BINARY)
    8081        EXTRA_OUTPUT += $(BINARY).disasm
    8182        EXTRA_CLEAN += $(BINARY).map
     
    8586        JOB = $(LIBRARY).job
    8687        OUTPUT = $(LIBRARY).a
     88        TEST_BINARY = test-$(LIBRARY)
    8789endif
    8890
     
    142144LIBNIC_PREFIX = $(LIB_PREFIX)/nic
    143145LIBMINIX_PREFIX = $(LIB_PREFIX)/minix
     146LIBCOMPRESS_PREFIX = $(LIB_PREFIX)/compress
    144147
    145148LIBSCSI_PREFIX = $(LIB_PREFIX)/scsi
     
    201204endif
    202205
     206# PCUT-based unit tests
     207ifneq ($(TEST_SOURCES),)
     208        TEST_OUTPUT = $(TEST_BINARY)
     209        TEST_CFLAGS = -I$(LIB_PREFIX)/pcut/include -D__helenos__
     210        TEST_OUTPUT_LIBS = $(LIB_PREFIX)/pcut/libpcut.a
     211        EXTRA_CLEAN += $(TEST_OUTPUT) $(TEST_OUTPUT).map
     212ifneq ($(LIBRARY),)
     213        TEST_OUTPUT_LIBS += $(OUTPUT)
     214endif
     215        TEST_OUTPUT_LIBS += $(TEST_LIBS)
     216endif
     217
    203218.PHONY: all clean
    204219
    205220all: $(VERSION_DEF) $(COMMON_MAKEFILE) $(CONFIG_MAKEFILE) $(CONFIG_HEADER) $(LIBS) $(OUTPUT) $(LOUTPUT) $(EXTRA_OUTPUT)
    206221        -[ -f $(DEPEND) ] && cp -a $(DEPEND) $(DEPEND_PREV)
     222
     223all-test: $(TEST_OUTPUT)
    207224
    208225clean:
     
    295312OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
    296313LOBJECTS := $(addsuffix .lo,$(basename $(SOURCES)))
     314TEST_OBJECTS := $(addsuffix .test.o,$(basename $(TEST_SOURCES)))
    297315
    298316ifneq ($(BINARY),)
     
    339357endif
    340358
     359ifneq ($(TEST_OUTPUT),)
     360$(TEST_OUTPUT): $(LINKER_SCRIPT) $(TEST_OBJECTS) $(TEST_OUTPUT_LIBS)
     361        $(LD) -n $(LFLAGS) -T $(LINKER_SCRIPT) -M -Map $(TEST_OUTPUT).map -o $@ $(TEST_OBJECTS) $(TEST_OUTPUT_LIBS) $(LIBS) $(BASE_LIBS)
     362ifeq ($(CONFIG_STRIP_BINARIES),y)
     363        $(STRIP) $(TEST_OUTPUT)
     364endif
     365endif
     366
    341367%.o: %.S $(DEPEND)
    342368        $(GCC) $(DEFS) $(GCC_CFLAGS) -D__ASM__ -c $< -o $@
     
    357383endif
    358384
     385%.test.o: %.c $(DEPEND)
     386        $(CC) $(DEFS) $(CFLAGS) $(TEST_CFLAGS) -c $< -o $@
     387ifeq ($(PRECHECK),y)
     388        $(JOBFILE) $(JOB) $< $@ cc core $(DEFS) $(CFLAGS)
     389endif
     390
    359391%.lo: %.S $(DEPEND)
    360392        $(CC) $(DEFS) $(LIB_CFLAGS) -D__ASM__ -c $< -o $@
     
    376408
    377409$(DEPEND): $(PRE_DEPEND)
    378         makedepend -f - -- $(DEPEND_DEFS) $(CFLAGS) -- $(SOURCES) > $@ 2> /dev/null
     410        makedepend -f - -- $(DEPEND_DEFS) $(CFLAGS) -- $(SOURCES) $(TEST_SOURCES) > $@ 2> /dev/null
    379411        -[ -f $(DEPEND_PREV) ] && diff -q $(DEPEND_PREV) $@ && mv -f $(DEPEND_PREV) $@
    380412
Note: See TracChangeset for help on using the changeset viewer.