build: improve rules for test programs

This generates dependencies for the *-test.o files ensuring
rebuilds when necessary.

Signed-off-by: Mans Rullgard <mans@mansr.com>
This commit is contained in:
Mans Rullgard 2011-06-25 11:51:09 +01:00
parent bc877faf7f
commit 659aa20e56

View File

@ -11,16 +11,17 @@ all-$(CONFIG_STATIC): $(SUBDIR)$(LIBNAME)
all-$(CONFIG_SHARED): $(SUBDIR)$(SLIBNAME) all-$(CONFIG_SHARED): $(SUBDIR)$(SLIBNAME)
$(SUBDIR)%-test.o: $(SUBDIR)%-test.c $(SUBDIR)%-test.o: $(SUBDIR)%-test.c
$(CC) $(CPPFLAGS) $(CFLAGS) -DTEST -c $(CC_O) $^ $(COMPILE_C)
$(SUBDIR)%-test.o: $(SUBDIR)%.c $(SUBDIR)%-test.o: $(SUBDIR)%.c
$(CC) $(CPPFLAGS) $(CFLAGS) -DTEST -c $(CC_O) $^ $(COMPILE_C)
$(SUBDIR)x86/%.o: $(SUBDIR)x86/%.asm $(SUBDIR)x86/%.o: $(SUBDIR)x86/%.asm
$(YASMDEP) $(YASMFLAGS) -I $(<D)/ -M -o $@ $< > $(@:.o=.d) $(YASMDEP) $(YASMFLAGS) -I $(<D)/ -M -o $@ $< > $(@:.o=.d)
$(YASM) $(YASMFLAGS) -I $(<D)/ -o $@ $< $(YASM) $(YASMFLAGS) -I $(<D)/ -o $@ $<
$(OBJS) $(SUBDIR)%.ho $(SUBDIR)%-test.o $(TESTOBJS): CPPFLAGS += -DHAVE_AV_CONFIG_H $(OBJS) $(SUBDIR)%.ho $(TESTOBJS): CPPFLAGS += -DHAVE_AV_CONFIG_H
$(TESTOBJS): CPPFLAGS += -DTEST
$(SUBDIR)$(LIBNAME): $(OBJS) $(SUBDIR)$(LIBNAME): $(OBJS)
$(RM) $@ $(RM) $@