summaryrefslogtreecommitdiff
path: root/rules/osgi42-core/Makefile
blob: 30eb1f7fb293b315ca96ba96a0763f703d864f84 (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
DESTDIR ?=
MAVEN_LOCAL_REPO ?= ~/.m2

FAIL    = exit 1
FIND    = find
INSTALL = install
JAR     = jar
JAVAC   = javac
MKDIRS  = mkdir -p
RM      = rm -f

groupId    = org.osgi
artifactId = org.osgi.core
version    = 5.0.0

dep_dir = $1 $(shell $(FIND) $1 2>/dev/null)
mvndir = $(DESTDIR)$(MAVEN_LOCAL_REPO)/$(subst .,/,$(groupId))/$(artifactId)/$(version)

all: PHONY build/$(artifactId)-$(version).jar
install: PHONY $(mvndir)/$(artifactId)-$(version).jar

build/classes: $(call dep_dir,src)
	$(RM) -r $@
	$(MKDIRS) $@
	$(FIND) src -name '*.java' -exec $(JAVAC) -d $@ {} + || { $(RM) -r $@; $(FAIL); }
build/$(artifactId)-$(version).jar: $(call dep_dir,build/classes)
	$(JAR) -cf $@ -C build/classes .
$(mvndir)/$(artifactId)-$(version).jar: build/$(artifactId)-$(version).jar
	$(INSTALL) -Dm644 $< $@

clean: PHONY
	$(RM) -r build

.PHONY: PHONY
.DELETE_ON_ERROR: