Commit 996fdfdc authored by Sam Ravnborg's avatar Sam Ravnborg

kbuild: Move flags to Makefile.lib

a_flags defined in Makefile.lib, and a set of flags made for host
related rules. This avoided some duplication in Makefile.build
parent 621ce5a8
...@@ -103,7 +103,9 @@ cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $< ...@@ -103,7 +103,9 @@ cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $<
$(call if_changed_dep,cc_o_c) $(call if_changed_dep,cc_o_c)
quiet_cmd_cc_lst_c = MKLST $@ quiet_cmd_cc_lst_c = MKLST $@
cmd_cc_lst_c = $(CC) $(c_flags) -g -c -o $*.o $< && sh scripts/makelst $*.o System.map $(OBJDUMP) > $@ cmd_cc_lst_c = $(CC) $(c_flags) -g -c -o $*.o $< && \
$(CONFIG_SHELL) $(src)/scripts/makelst $*.o \
System.map $(OBJDUMP) > $@
%.lst: %.c FORCE %.lst: %.c FORCE
$(call if_changed_dep,cc_lst_c) $(call if_changed_dep,cc_lst_c)
...@@ -116,9 +118,6 @@ modkern_aflags := $(AFLAGS_KERNEL) ...@@ -116,9 +118,6 @@ modkern_aflags := $(AFLAGS_KERNEL)
$(real-objs-m) : modkern_aflags := $(AFLAGS_MODULE) $(real-objs-m) : modkern_aflags := $(AFLAGS_MODULE)
$(real-objs-m:.o=.s): modkern_aflags := $(AFLAGS_MODULE) $(real-objs-m:.o=.s): modkern_aflags := $(AFLAGS_MODULE)
a_flags = -Wp,-MD,$(depfile) $(AFLAGS) $(NOSTDINC_FLAGS) \
$(modkern_aflags) $(EXTRA_AFLAGS) $(AFLAGS_$(*F).o)
quiet_cmd_as_s_S = CPP $(quiet_modtag) $@ quiet_cmd_as_s_S = CPP $(quiet_modtag) $@
cmd_as_s_S = $(CPP) $(a_flags) -o $@ $< cmd_as_s_S = $(CPP) $(a_flags) -o $@ $<
...@@ -217,9 +216,7 @@ targets += $(multi-used-y) $(multi-used-m) ...@@ -217,9 +216,7 @@ targets += $(multi-used-y) $(multi-used-m)
# Create executable from a single .c file # Create executable from a single .c file
# host-csingle -> Executable # host-csingle -> Executable
quiet_cmd_host-csingle = HOSTCC $@ quiet_cmd_host-csingle = HOSTCC $@
cmd_host-csingle = $(HOSTCC) -Wp,-MD,$(depfile) \ cmd_host-csingle = $(HOSTCC) $(hostc_flags) $(HOST_LOADLIBES) -o $@ $<
$(HOSTCFLAGS) $(HOST_EXTRACFLAGS) \
$(HOST_LOADLIBES) -o $@ $<
$(host-csingle): %: %.c FORCE $(host-csingle): %: %.c FORCE
$(call if_changed_dep,host-csingle) $(call if_changed_dep,host-csingle)
...@@ -235,9 +232,7 @@ $(host-cmulti): %: $(host-cobjs) $(host-cshlib) FORCE ...@@ -235,9 +232,7 @@ $(host-cmulti): %: $(host-cobjs) $(host-cshlib) FORCE
# Create .o file from a single .c file # Create .o file from a single .c file
# host-cobjs -> .o # host-cobjs -> .o
quiet_cmd_host-cobjs = HOSTCC $@ quiet_cmd_host-cobjs = HOSTCC $@
cmd_host-cobjs = $(HOSTCC) -Wp,-MD,$(depfile) \ cmd_host-cobjs = $(HOSTCC) $(hostc_flags) -c -o $@ $<
$(HOSTCFLAGS) $(HOST_EXTRACFLAGS) \
$(HOSTCFLAGS_$(@F)) -c -o $@ $<
$(host-cobjs): %.o: %.c FORCE $(host-cobjs): %.o: %.c FORCE
$(call if_changed_dep,host-cobjs) $(call if_changed_dep,host-cobjs)
...@@ -253,18 +248,14 @@ $(host-cxxmulti): %: $(host-cobjs) $(host-cxxobjs) $(host-cshlib) FORCE ...@@ -253,18 +248,14 @@ $(host-cxxmulti): %: $(host-cobjs) $(host-cxxobjs) $(host-cshlib) FORCE
# Create .o file from a single .cc (C++) file # Create .o file from a single .cc (C++) file
quiet_cmd_host-cxxobjs = HOSTCXX $@ quiet_cmd_host-cxxobjs = HOSTCXX $@
cmd_host-cxxobjs = $(HOSTCXX) -Wp,-MD,$(depfile) \ cmd_host-cxxobjs = $(HOSTCXX) $(hostcxx_flags) -c -o $@ $<
$(HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) \
$(HOSTCXXFLAGS_$(@F)) -c -o $@ $<
$(host-cxxobjs): %.o: %.cc FORCE $(host-cxxobjs): %.o: %.cc FORCE
$(call if_changed_dep,host-cxxobjs) $(call if_changed_dep,host-cxxobjs)
# Compile .c file, create position independent .o file # Compile .c file, create position independent .o file
# host-cshobjs -> .o # host-cshobjs -> .o
quiet_cmd_host-cshobjs = HOSTCC -fPIC $@ quiet_cmd_host-cshobjs = HOSTCC -fPIC $@
cmd_host-cshobjs = $(HOSTCC) -Wp,-MD,$(depfile) -fPIC\ cmd_host-cshobjs = $(HOSTCC) $(hostc_flags) -fPIC -c -o $@ $<
$(HOSTCFLAGS) $(HOST_EXTRACFLAGS) \
$(HOSTCFLAGS_$(@F)) -c -o $@ $<
$(host-cshobjs): %.o: %.c FORCE $(host-cshobjs): %.o: %.c FORCE
$(call if_changed_dep,host-cshobjs) $(call if_changed_dep,host-cshobjs)
......
...@@ -128,6 +128,12 @@ modname_flags = -DKBUILD_MODNAME=$(subst $(comma),_,$(subst -,_,$(modname))) ...@@ -128,6 +128,12 @@ modname_flags = -DKBUILD_MODNAME=$(subst $(comma),_,$(subst -,_,$(modname)))
c_flags = -Wp,-MD,$(depfile) $(CFLAGS) $(NOSTDINC_FLAGS) \ c_flags = -Wp,-MD,$(depfile) $(CFLAGS) $(NOSTDINC_FLAGS) \
$(modkern_cflags) $(EXTRA_CFLAGS) $(CFLAGS_$(*F).o) \ $(modkern_cflags) $(EXTRA_CFLAGS) $(CFLAGS_$(*F).o) \
$(basename_flags) $(modname_flags) $(export_flags) $(basename_flags) $(modname_flags) $(export_flags)
a_flags = -Wp,-MD,$(depfile) $(AFLAGS) $(NOSTDINC_FLAGS)\
$(modkern_aflags) $(EXTRA_AFLAGS) $(AFLAGS_$(*F).o)
hostc_flags = -Wp,-MD,$(depfile) $(HOSTCFLAGS) $(HOST_EXTRACFLAGS)\
$(HOSTCFLAGS_$(*F).o)
hostcxx_flags = -Wp,-MD,$(depfile) $(HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS)\
$(HOSTCXXFLAGS_$(*F).o)
# Finds the multi-part object the current object will be linked into # Finds the multi-part object the current object will be linked into
modname-multi = $(subst $(space),_,$(strip $(foreach m,$(multi-used),\ modname-multi = $(subst $(space),_,$(strip $(foreach m,$(multi-used),\
...@@ -139,7 +145,7 @@ modname-multi = $(subst $(space),_,$(strip $(foreach m,$(multi-used),\ ...@@ -139,7 +145,7 @@ modname-multi = $(subst $(space),_,$(strip $(foreach m,$(multi-used),\
quiet_cmd_shipped = SHIPPED $@ quiet_cmd_shipped = SHIPPED $@
cmd_shipped = cat $< > $@ cmd_shipped = cat $< > $@
%:: %_shipped $(obj)/%:: $(src)/%_shipped
$(call cmd,shipped) $(call cmd,shipped)
# Commands useful for building a boot image # Commands useful for building a boot image
......
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