diff options
Diffstat (limited to 'llbuild')
-rw-r--r-- | llbuild/Makefile.include | 40 |
1 files changed, 18 insertions, 22 deletions
diff --git a/llbuild/Makefile.include b/llbuild/Makefile.include index 349a88a..02115e8 100644 --- a/llbuild/Makefile.include +++ b/llbuild/Makefile.include @@ -31,10 +31,8 @@ LLBUILD ?= $(TOPDIR)/llbuild built_in_target := built-in.o -define expand_objects -endef - -all_objects := $(obj-builtin) +all_objects := $(subdirs) +all_objects += $(obj-builtin) all_objects += $(foreach t,$(extra_targets),$($(t))) filter_subdirs := $(shell for d in $(all_objects) ; do if [ -d $$d ]; then echo $$d; fi; done) @@ -46,6 +44,8 @@ builtin_filter_objects := $(shell for f in $(obj-builtin) ; do if [ -d $$f ]; th real_subdirs := $(foreach dir,$(filter_subdirs),$(shell readlink -f $(CURDIR)/$(dir))) subdir_deps := $(foreach path,$(real_subdirs),$(dir $(path)).$(notdir $(path).subdir.d)) +.PRECIOUS: $(filter_objects) + LOCK ?= $(LLBUILD)/llflock $@.lock %.subdir.d: @@ -55,43 +55,35 @@ LOCK ?= $(LLBUILD)/llflock $@.lock # these are for handling extra_targets -bin-%: _build_objects +bin-%: $(filter_objects) @run_sources="$($@)"; \ run_target="$(patsubst bin-%,%,$@)"; \ - run_cmd="$(CC) $(LDFLAGS) -o $(patsubst bin-%,%,$@) $(shell for f in $($@) ; do if [ -d $$f ]; then echo $$f/built-in.o; else echo $$f; fi; done) $(LIBS)"; \ + run_cmd="$(CC) $(CCFLAGS) $(LDFLAGS) -o $(patsubst bin-%,%,$@) $(shell for f in $($@) ; do if [ -d $$f ]; then echo $$f/built-in.o; else echo $$f; fi; done) $(LIBS)"; \ run_alias="BIN"; \ $(ll_pretty_run) -cxxbin-%: _build_objects +cxxbin-%: $(filter_objects) @run_sources="$($@)"; \ run_target="$(patsubst cxxbin-%,%,$@)"; \ - run_cmd="$(CXX) $(LDFLAGS) -o $(patsubst cxxbin-%,%,$@) $(shell for f in $($@) ; do if [ -d $$f ]; then echo $$f/built-in.o; else echo $$f; fi; done) $(LIBS)"; \ + run_cmd="$(CXX) $(CFLAGS) $(LDFLAGS) $(CXXFLAGS) -o $(patsubst cxxbin-%,%,$@) $(shell for f in $($@) ; do if [ -d $$f ]; then echo $$f/built-in.o; else echo $$f; fi; done) $(LIBS)"; \ run_alias="CXXBIN"; \ $(ll_pretty_run) -shlib-%: _build_objects +shlib-%: $(filter_objects) @run_sources="$($@)"; \ run_target="$(patsubst shlib-%,%,$@)"; \ - run_cmd="$(CC) $(LDFLAGS) -shared -o $(patsubst shlib-%,%,$@) $(shell for f in $($@) ; do if [ -d $$f ]; then echo $$f/built-in.o; else echo $$f; fi; done) $(LIBS)"; \ + run_cmd="$(CC) $(CFLAGS) $(LDFLAGS) -shared -o $(patsubst shlib-%,%,$@) $(shell for f in $($@) ; do if [ -d $$f ]; then echo $$f/built-in.o; else echo $$f; fi; done) $(LIBS)"; \ run_alias="SHLIB"; \ $(ll_pretty_run) ll_mainlevel: @find $(TOPDIR) -name "*.subdir.d.lock" -o -name "*.subdir.d" | xargs rm -f - @$(MAKE) --no-print-directory -f $(LLBUILD)/Makefile.build $(subdir_deps) + @$(MAKE) --no-print-directory -f $(LLBUILD)/Makefile.build ll_subdir ll_subdir: $(subdir_deps) @$(MAKE) --no-print-directory -f $(LLBUILD)/Makefile.build $(built_in_target) $(extra_targets) -# build all objects for all targets before linking them -ifeq ("$(strip $(filter_objects))", "") -_build_objects: - @true -else -_build_objects: $(filter_objects) -endif - ifeq ("$(strip $(builtin_filter_objects))", "") $(built_in_target): @true @@ -101,6 +93,9 @@ $(built_in_target): $(builtin_filter_objects) endif OPT_CURDIR = $(patsubst /%,%,$(strip $(subst $(TOPDIR), , $(CURDIR)))) +ifeq ("$(OPT_CURDIR)","") +OPT_CURDIR="." +endif ifndef ll_verbose define ll_pretty_run @@ -132,7 +127,7 @@ endef define ll_pretty_build_cc @run_sources="$<"; \ run_target="$@"; \ - run_cmd="$(CXX) $(CFLAGS) -Wp,-MD,$(dir $(@))/.$(notdir $(@)).d -o $@ -c $<"; \ + run_cmd="$(CXX) $(CFLAGS) $(CXXFLAGS) -Wp,-MD,$(dir $(@))/.$(notdir $(@)).d -o $@ -c $<"; \ run_alias="CXX"; \ $(ll_pretty_run) endef @@ -148,7 +143,7 @@ endef define ll_pretty_link_shared_library @run_sources="$^"; \ run_target="$@"; \ - run_cmd="$(CC) $(LDFLAGS) -shared -o $@ $^ $(LIBS)"; \ + run_cmd="$(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $^ $(LIBS)"; \ run_alias="SHLIB"; \ $(ll_pretty_run) endef @@ -156,9 +151,10 @@ endef define ll_pretty_link_shared_binary @run_sources="$^"; \ run_target="$@"; \ - run_cmd="$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)"; \ + run_cmd="$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)"; \ run_alias="BIN";\ $(ll_pretty_run) + echo "after linking shared binary" endef %.o: %.S |