blob: 5c654d2270f39c67c762cc5fae9d926c631450c9 (
plain)
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
|
DESTDIR ?=
MAVEN_LOCAL_REPO ?= ~/.m2
EXISTS = test -e
FIND = find
INSTALL = install
RM = rm -f
SED = sed
TOUCH = touch
XMLSTARLET = xml
artifactId := $(shell $(XMLSTARLET) sel -T -t -c /_:project/_:artifactId -n pom.xml)
version := $(shell $(XMLSTARLET) sel -T -t -c /_:project/_:version -n pom.xml)
groupId := $(shell $(XMLSTARLET) sel -T -t -c /_:project/_:groupId -n pom.xml)
all: PHONY build
build: $(shell $(FIND) src)
$(SED) -e 's/VERSION=.*/VERSION=$(version)/' -e /tck/d -e /junit/d build.sh | $(SHELL) || { $(RM) -r $@; exit 1; }
$(TOUCH) $@
install-dir = $(DESTDIR)$(MAVEN_LOCAL_REPO)/$(subst .,/,$(groupId))/$(artifactId)/$(version)
install-targets = $(addprefix $(install-dir)/$(artifactId)-$(version),.pom .jar -sources.jar -javadoc.jar)
install: PHONY $(install-targets)
$(filter-out %.pom,$(install-targets)): $(install-dir)/%: build/maven/%
$(INSTALL) -Dm644 $< $@
$(install-dir)/$(artifactId)-$(version).pom: build/maven/pom.xml
$(INSTALL) -Dm644 $< $@
$(addprefix build/maven/,$(notdir $(filter-out %.pom,$(install-targets)) pom.xml)): build/maven/%: build
$(EXISTS) $@
$(TOUCH) $@
clean: PHONY
$(RM) -r build
.PHONY: PHONY
|