Create the target directory of libraries and programs

This commit is contained in:
Eelco Dolstra 2014-02-06 10:59:58 +01:00
parent 0da82efa5d
commit 4161fce472
4 changed files with 9 additions and 4 deletions

View file

@ -4,7 +4,7 @@ define create-dir
ifndef $(1)_SEEN
$(1)_SEEN = 1
$(1):
$$(trace-install) install -d $(1)
$$(trace-mkdir) install -d $(1)
endif
endef

View file

@ -50,6 +50,8 @@ define build-library
$(1)_LDFLAGS_USE :=
$(1)_LDFLAGS_USE_INSTALLED :=
$$(eval $$(call create-dir,$$(_d)))
ifeq ($(BUILD_SHARED_LIBS), 1)
ifdef $(1)_ALLOW_UNDEFINED
@ -64,7 +66,7 @@ define build-library
$(1)_PATH := $$(_d)/$$($(1)_NAME).$(SO_EXT)
$$($(1)_PATH): $$($(1)_OBJS) $$(_libs)
$$($(1)_PATH): $$($(1)_OBJS) $$(_libs) | $$(_d)
$$(trace-ld) $(CXX) -o $$@ -shared $(GLOBAL_LDFLAGS) $$($(1)_OBJS) $$($(1)_LDFLAGS) $$($(1)_LDFLAGS_PROPAGATED) $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS_USE))
$(1)_LDFLAGS_USE += -L$$(_d) -Wl,-rpath,$$(abspath $$(_d)) -l$$(patsubst lib%,%,$$(strip $$($(1)_NAME)))
@ -88,7 +90,7 @@ define build-library
$(1)_PATH := $$(_d)/$$($(1)_NAME).a
$$($(1)_PATH): $$($(1)_OBJS)
$$($(1)_PATH): $$($(1)_OBJS) | $$(_d)
$(trace-ar) ar crs $$@ $$?
$(1)_LDFLAGS_USE += $$($(1)_PATH) $$($(1)_LDFLAGS)

View file

@ -22,7 +22,9 @@ define build-program
_libs := $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_PATH))
$(1)_PATH := $$(_d)/$(1)
$$($(1)_PATH): $$($(1)_OBJS) $$(_libs)
$$(eval $$(call create-dir,$$(_d)))
$$($(1)_PATH): $$($(1)_OBJS) $$(_libs) | $$(_d)
$$(trace-ld) $(CXX) -o $$@ $(GLOBAL_LDFLAGS) $$($(1)_OBJS) $$($(1)_LDFLAGS) $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS_USE))
$(1)_INSTALL_DIR ?= $$(bindir)

View file

@ -10,6 +10,7 @@ ifeq ($(V), 0)
trace-install = @echo " INST " $@;
trace-javac = @echo " JAVAC " $@;
trace-jar = @echo " JAR " $@;
trace-mkdir = @echo " MKDIR " $@;
suppress = @