summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2014-05-29 18:36:14 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2014-05-29 18:36:14 -0400
commita116f3f2bdebc24d16743c53cd738f62a56f4787 (patch)
tree1a347e82113542b0f71eff189b278e85b766ebd8 /Makefile
parent2a92c8ff365993d2491440982747e0c139c9416a (diff)
Control dependencies+CLASSPATH from conf/dependencies.mk
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile29
1 files changed, 22 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index 8e2d008..bceb9a1 100644
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,12 @@
top := $(shell pwd)
all: package
+
+# configuration ################################################################
+
packages := $(filter-out _%,$(shell sed "s/[\# ].*//" conf/sources.mk))
include conf/sources.mk
+include conf/dependencies.mk
export MAVEN_LOCAL_REPO := $(shell cat conf/maven.local.repo.txt)
# download #####################################################################
@@ -64,7 +68,7 @@ build/extract/tar/%: build/download/tar/%
cd '$@' && bsdtar --strip-components 1 -xf '$(top)/$<'
cd '$@' && git init && git add . && git commit -q -m 'extracted $(shell utils/file2url 'tar/$*')' # XXX
-# place ########################################################################
+# place (patch) ################################################################
place: PHONY $(addprefix,build/compile/,$(packages))
@@ -95,13 +99,24 @@ package: PHONY $(addprefix build/packages/,$(packages))
package_specific=$(filter $(patsubst makefiles/%.mk,%,$(wildcard makefiles/*.mk)),$(packages))
package_generic =$(filter-out $(patsubst makefiles/%.mk,%,$(wildcard makefiles/*.mk)),$(packages))
-$(addprefix build/packages/,$(package_specific)): build/packages/%: RECURSIVE build/compile/% makefiles/%.mk
- $(MAKE) -C build/compile/$* -f "$(top)/makefiles/$*.mk" install DESTDIR="$(top)/$@"
- mkdir -p build/packages/dest && lndir -silent "$(top)/$@" build/packages/dest
+dirs2jars = $(if $1,$(shell find $1 -name '*.jar'))
+deps2jars = $(filter %.jar,$1) $(call dirs2jars,$(filter build/packages/%,$1))
+deps2classpath = $(shell echo $(abspath $(call deps2jars,$1)) | tr ' ' :)
+
+$(addprefix build/packages/,$(package_specific)): \
+build/packages/%: RECURSIVE build/compile/% makefiles/%.mk
+ $(MAKE) -C build/compile/$* -f '$(top)/makefiles/$*.mk' install
+ DESTDIR='$(top)/$@' \
+ CLASSPATH='$(call deps2classpath,$^)'
+ mkdir -p build/packages/dest && lndir -silent '$(top)/$@' build/packages/dest
+
-$(addprefix build/packages/,$(package_generic)): build/packages/%: RECURSIVE build/compile/% makefiles/mvn-simple.mk
- $(MAKE) -C build/compile/$* -f "$(top)/makefiles/mvn-simple.mk" install DESTDIR="$(top)/$@"
- mkdir -p build/packages/dest && lndir -silent "$(top)/$@" build/packages/dest
+$(addprefix build/packages/,$(package_generic)): \
+build/packages/%: RECURSIVE build/compile/% makefiles/mvn-simple.mk
+ $(MAKE) -C build/compile/$* -f '$(top)/makefiles/mvn-simple.mk' install \
+ DESTDIR='$(top)/$@' \
+ CLASSPATH='$(call deps2classpath,$^)'
+ mkdir -p build/packages/dest && lndir -silent '$(top)/$@' build/packages/dest
# dependencies #################################################################