-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
70 lines (52 loc) · 1.69 KB
/
Makefile
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#
# Makefile for compiling Test.java and also JVM TI agent native library.
#
# Pavel Tisnovsky <ptisnovs@redhat.com>
#
# Useful .bashrc aliases for us lazy Java developers:
# alias m=make
# alias b=make build
# alias r=make run
# alias c=make clean
OUT_DIR=bin
PKG_DIR=package
all: run
build: $(OUT_DIR)
cd $(OUT_DIR) && make
builddebug:
$(MAKE) distclean build CMAKE_OPTS="-DCMAKE_BUILD_TYPE=Debug"
.PHONY: run
run: build
cd $(OUT_DIR) && make run
.PHONY: dist
dist: $(OUT_DIR)
cd $(OUT_DIR) && make dist
RPM_DIRS = --define "_sourcedir `pwd`/$(OUT_DIR)" \
--define "_rpmdir `pwd`/$(OUT_DIR)" \
--define "_specdir `pwd`/$(PKG_DIR)" \
--define "_builddir `pwd`/$(OUT_DIR)" \
--define "_srcrpmdir `pwd`/$(OUT_DIR)"
.PHONY: rpm
rpm: dist
sed -e 's/global commit .*$$/global commit '"$$(git log -1 --format=%H)"'/' \
-e 's/%{?dist}/.'"$$(git log -1 --format=%h)%{?dist}"'/' \
$(PKG_DIR)/abrt-java-connector.spec > $(OUT_DIR)/abrt-java-connector.spec && \
rpmbuild $(RPM_DIRS) $(RPM_FLAGS) -ba $(OUT_DIR)/abrt-java-connector.spec
.PHONY: srpm
srpm: dist
sed -e 's/global commit .*$$/global commit '"$$(git log -1 --format=%H)"'/' \
-e 's/%{?dist}/.'"$$(git log -1 --format=%h)%{?dist}"'/' \
$(PKG_DIR)/abrt-java-connector.spec > $(OUT_DIR)/abrt-java-connector.spec && \
rpmbuild $(RPM_DIRS) $(RPM_FLAGS) -bs $(OUT_DIR)/abrt-java-connector.spec
# Make sure the output dir is created
$(OUT_DIR):
mkdir -p $@ && cd $@ && cmake $$CMAKE_OPTS ../
.PHONY: clean
clean:
cd $(OUT_DIR) && make clean
.PHONY: distclean
distclean:
rm -rf $(OUT_DIR)
.PHONY: check
check: build
if [ "_0" != "_$$(id -u)" ]; then cd $(OUT_DIR) && make test; else echo "Cannot run tests under root user."; exit 1; fi