1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
DESTDIR ?=
MAVEN_LOCAL_REPO ?= ~/.m2
ANT = ant
EXISTS = test -e
FAIL = exit 1
FIND = find
INSTALL = install
MKDIRS = mkdir -p
RM = rm -f
SED = sed
TOUCH = touch
artifactIds := $(patsubst archive/%.mf,%,$(wildcard archive/*.mf))
version := $(shell $(SED) -n 's/^product\.version\s\s*//p' build.properties)
groupId := asm
findjar = $(firstword $(foreach path,$(subst :, ,$(CLASSPATH)),$(if $(findstring $1,$(path)),$(path))) /notfound.jar)
ow_util_ant_tasks_jar = $(call findjar,ow_util_ant_tasks)
all: PHONY output
output: $(shell $(FIND) src) | test/lib
$(SED) -i -e '/^objectweb.ant.tasks.path/d' -e '$$aobjectweb.ant.tasks.path $(ow_util_ant_tasks_jar)' build.properties && \
$(ANT) dist || \
{ $(RM) -r $@; $(FAIL); }
$(TOUCH) $@
test/lib:
$(MKDIRS) $@
install-base = $(DESTDIR)$(MAVEN_LOCAL_REPO)/$(subst .,/,$(groupId))/$(artifactId)/$(version)/$(artifactId)-$(version)
install-jars = $(foreach artifactId,$(artifactIds),$(install-base).jar)
install-poms = $(foreach artifactId,$(artifactIds),$(install-base).pom)
install-targets = $(install-jars) $(install-poms)
install: PHONY $(install-targets)
$(foreach target,$(install-jars),$(eval $(target): output/dist/lib/$(notdir $(target)) ; $$(INSTALL) -Dm644 $$< $$@))
$(foreach target,$(install-poms),$(eval $(target): output/dist/lib/$(patsubst %.pom,%.xml,$(notdir $(target))) ; $$(INSTALL) -Dm644 $$< $$@))
$(addprefix output/dist/lib/,$(patsubst %.pom,%.xml,$(notdir $(install-targets)))): output
$(EXISTS) $@
$(TOUCH) $@
clean: PHONY
$(RM) -r output
.PHONY: PHONY
.DELETE_ON_ERROR:
.SECONDARY:
|