2 ThisMake := $(lastword $(MAKEFILE_LIST))
3 TOP := $(dir $(ThisMake))
6 mkdir -p $(TOP)$(ObjDir) ; $(MAKE) -C $(TOP)$(ObjDir) VPATH=.. S=../ -f ../Makefile $*
12 # This is included at the end of each subdir makefile
13 # We need to make each target from its objs
17 $(if $(HaveCommon),,$(eval include $(D)../MakeCommon))
19 D2 := $(if $(D),$(D),nothing)
22 targets/$(1) : $(D)$(1)
23 mkdir -p targets ; cp $(D)$(1) targets/$(1)
25 $(D)$(1) : $(patsubst $(D2)../%,%, $(addprefix $(D),$(obj-$(1))))
26 $$(CC) -o $$@ $$^ $$(LDLIBS) $$(lib-$(1))
27 -include $(patsubst %.o,$(D)%.c.d,$(filter %.o,$(obj-$(1))))
31 $(foreach t,$(target),$(eval $(call TargetTemplate,$(t))))
34 define LibraryTemplate
37 $(D)$(1) : $(patsubst $(D2)../%,%,$(addprefix $(D),$(obj-$(1))))
41 $(foreach l,$(lib),$(eval $(call LibraryTemplate,$(l))))
46 include $$(S)$$(D)Makefile
52 $(foreach dir,$(dtmp),$(eval $(call DirTemplate,$(dir))))