Commit b9cd834a authored by Thaodan's avatar Thaodan

[sb2] Create output dir before recipe execution

The output directory has to exist before make creates the dependency
graph or the build may break when CWD is not $(SCRDIR).
This for example caused in case of rule_tree.o make to have to receipes for the same file one with -fPIC
and one without -fPIC breaking PIC and breaking building on x86_64.
parent a19b935f
......@@ -44,6 +44,7 @@ define import_dir
objects :=
objects-y :=
D := $(1)
$(shell -p mkdir $(1))
include $(1)/Makefile
dep_files := $$(wildcard $(1)/.*.d)
include $(dep_files)
......@@ -59,7 +60,6 @@ $(foreach dir,$(subdirs),$(eval $(call import_dir,$(dir))))
all_objects += $(foreach t,$(extra_targets),$($(t)))
MKOUTPUTDIR = @mkdir -p $(dir $@)
ifdef V
Q =
......@@ -70,42 +70,34 @@ Q = @
$(Q)$(CC) $(CFLAGS) $(LDFLAGS) -dynamiclib -o $@ $^ $(LIBS)
$(Q)$(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $^ $(LIBS)
$(Q)$(CC) $(LDFLAGS) -r -nostdlib -nodefaultlibs -nostartfiles -o $@ $^
built-in.o:: %.o
$(Q)$(CC) -r -nostdlib -nodefaultlibs -nostartfiles -o $@ $^
%.o:: %.S
$(Q)$(CC) $(CFLAGS) -D__ASSEMBLY__ -Wp,-MT,$@ -Wp,-MMD,$(dir $@).$(notdir $@).d -o $@ -c $<
%.o:: %.c
$(Q)$(CC) $(CFLAGS) -Wp,-MT,$@ -Wp,-MMD,$(dir $@).$(notdir $@).d -o $@ -c $<
$(Q)$(CXX) $(CFLAGS) $(CXXFLAGS) -Wp,-MT,$@ -Wp,-MMD,$(dir $@)/.$(notdir $@).d -o $@ -c $<
%.o:: %.cpp
$(Q)$(CXX) $(CFLAGS) $(CXXFLAGS) -Wp,-MT,$@ -Wp,-MMD,$(dir $@)/.$(notdir $@).d -o $@ -c $<
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