Commit 01474cc4 authored by Kai Germaschewski's avatar Kai Germaschewski

Rules.make cleanup: introduce c_flags, a_flags

parent dc79d6c5
...@@ -54,37 +54,42 @@ ALL_SUB_DIRS := $(sort $(subdir-y) $(subdir-m) $(subdir-n) $(subdir-)) ...@@ -54,37 +54,42 @@ ALL_SUB_DIRS := $(sort $(subdir-y) $(subdir-m) $(subdir-n) $(subdir-))
# Common rules # Common rules
# #
c_flags = $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F)))
%.s: %.c %.s: %.c
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) $(CFLAGS_$@) -S $< -o $@ $(CC) $(c_flags) -S $< -o $@
%.i: %.c %.i: %.c
$(CPP) $(CFLAGS) $(EXTRA_CFLAGS) -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) $(CFLAGS_$@) $< > $@ $(CPP) $(c_flags) $< > $@
%.o: %.c %.o: %.c
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) $(CFLAGS_$@) -c -o $@ $< $(CC) $(c_flags) -c -o $@ $<
@ ( \ @ ( \
echo 'ifeq ($(strip $(subst $(comma),:,$(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@))),$$(strip $$(subst $$(comma),:,$$(CFLAGS) $$(EXTRA_CFLAGS) $$(CFLAGS_$@))))' ; \ echo 'ifeq ($(strip $(subst $(comma),:,$(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@))),$$(strip $$(subst $$(comma),:,$$(CFLAGS) $$(EXTRA_CFLAGS) $$(CFLAGS_$@))))' ; \
echo 'FILES_FLAGS_UP_TO_DATE += $@' ; \ echo 'FILES_FLAGS_UP_TO_DATE += $@' ; \
echo 'endif' \ echo 'endif' \
) > $(dir $@)/.$(notdir $@).flags ) > $(dir $@)/.$(notdir $@).flags
%.o: %.s
$(AS) $(AFLAGS) $(EXTRA_CFLAGS) -o $@ $<
# Old makefiles define their own rules for compiling .S files, # Old makefiles define their own rules for compiling .S files,
# but these standard rules are available for any Makefile that # but these standard rules are available for any Makefile that
# wants to use them. Our plan is to incrementally convert all # wants to use them. Our plan is to incrementally convert all
# the Makefiles to these standard rules. -- rmk, mec # the Makefiles to these standard rules. -- rmk, mec
ifdef USE_STANDARD_AS_RULE ifdef USE_STANDARD_AS_RULE
a_flags = $(AFLAGS) $(EXTRA_AFLAGS) $(AFLAGS_$@)
%.s: %.S %.s: %.S
$(CPP) $(AFLAGS) $(EXTRA_AFLAGS) $(AFLAGS_$@) $< > $@ $(CPP) $(a_flags) $< > $@
%.o: %.S %.o: %.S
$(CC) $(AFLAGS) $(EXTRA_AFLAGS) $(AFLAGS_$@) -c -o $@ $< $(CC) $(a_flags) -c -o $@ $<
endif endif
# FIXME is anybody using this rule? Why does it have EXTRA_CFLAGS?
%.o: %.s
$(AS) $(AFLAGS) $(EXTRA_CFLAGS) -o $@ $<
%.lst: %.c %.lst: %.c
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) -g -c -o $*.o $< $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) -g -c -o $*.o $<
$(TOPDIR)/scripts/makelst $* $(TOPDIR) $(OBJDUMP) $(TOPDIR)/scripts/makelst $* $(TOPDIR) $(OBJDUMP)
...@@ -322,7 +327,7 @@ endif # CONFIG_MODVERSIONS ...@@ -322,7 +327,7 @@ endif # CONFIG_MODVERSIONS
ifneq "$(strip $(export-objs))" "" ifneq "$(strip $(export-objs))" ""
$(export-objs): $(TOPDIR)/include/linux/modversions.h $(export-objs): $(TOPDIR)/include/linux/modversions.h
$(export-objs): %.o: %.c $(export-objs): %.o: %.c
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) $(CFLAGS_$@) -DEXPORT_SYMTAB -c $(@:.o=.c) $(CC) $(c_flags) -DEXPORT_SYMTAB -c -o $@ $<
@ ( \ @ ( \
echo 'ifeq ($(strip $(subst $(comma),:,$(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) -DEXPORT_SYMTAB)),$$(strip $$(subst $$(comma),:,$$(CFLAGS) $$(EXTRA_CFLAGS) $$(CFLAGS_$@) -DEXPORT_SYMTAB)))' ; \ echo 'ifeq ($(strip $(subst $(comma),:,$(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) -DEXPORT_SYMTAB)),$$(strip $$(subst $$(comma),:,$$(CFLAGS) $$(EXTRA_CFLAGS) $$(CFLAGS_$@) -DEXPORT_SYMTAB)))' ; \
echo 'FILES_FLAGS_UP_TO_DATE += $@' ; \ echo 'FILES_FLAGS_UP_TO_DATE += $@' ; \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment