build: add rules to generate preprocessed source files

This is useful for debugging.  Dependencies for these files are not
generated due to limitations in many compilers.

Signed-off-by: Mans Rullgard <mans@mansr.com>
This commit is contained in:
Mans Rullgard 2012-10-03 13:48:27 +01:00
parent 9ae80e6a9c
commit c262649291
3 changed files with 13 additions and 2 deletions

View File

@ -45,6 +45,9 @@ COMPILE_S = $(call COMPILE,AS)
%.o: %.S %.o: %.S
$(COMPILE_S) $(COMPILE_S)
%.i: %.c
$(CC) $(CCFLAGS) $(CC_E) $<
%.h.c: %.h.c:
$(Q)echo '#include "$*.h"' >$@ $(Q)echo '#include "$*.h"' >$@

1
configure vendored
View File

@ -3756,6 +3756,7 @@ ASFLAGS=$ASFLAGS
AS_C=$AS_C AS_C=$AS_C
AS_O=$AS_O AS_O=$AS_O
CC_C=$CC_C CC_C=$CC_C
CC_E=$CC_E
CC_O=$CC_O CC_O=$CC_O
LD_O=$LD_O LD_O=$LD_O
LD_LIB=$LD_LIB LD_LIB=$LD_LIB

View File

@ -17,12 +17,19 @@ $(SUBDIR)%-test.o: $(SUBDIR)%-test.c
$(SUBDIR)%-test.o: $(SUBDIR)%.c $(SUBDIR)%-test.o: $(SUBDIR)%.c
$(COMPILE_C) $(COMPILE_C)
$(SUBDIR)%-test.i: $(SUBDIR)%-test.c
$(CC) $(CCFLAGS) $(CC_E) $<
$(SUBDIR)%-test.i: $(SUBDIR)%.c
$(CC) $(CCFLAGS) $(CC_E) $<
$(SUBDIR)x86/%.o: $(SUBDIR)x86/%.asm $(SUBDIR)x86/%.o: $(SUBDIR)x86/%.asm
$(DEPYASM) $(YASMFLAGS) -I $(<D)/ -M -o $@ $< > $(@:.o=.d) $(DEPYASM) $(YASMFLAGS) -I $(<D)/ -M -o $@ $< > $(@:.o=.d)
$(YASM) $(YASMFLAGS) -I $(<D)/ -o $@ $< $(YASM) $(YASMFLAGS) -I $(<D)/ -o $@ $<
$(OBJS) $(SUBDIR)%.h.o $(TESTOBJS): CPPFLAGS += -DHAVE_AV_CONFIG_H LIBOBJS := $(OBJS) $(SUBDIR)%.h.o $(TESTOBJS)
$(TESTOBJS): CPPFLAGS += -DTEST $(LIBOBJS) $(LIBOBJS:.o=.i): CPPFLAGS += -DHAVE_AV_CONFIG_H
$(TESTOBJS) $(TESTOBJS:.o=.i): CPPFLAGS += -DTEST
$(SUBDIR)$(LIBNAME): $(OBJS) $(SUBDIR)$(LIBNAME): $(OBJS)
$(RM) $@ $(RM) $@