projects/aports·blob v2.0_rc8 · refs

81 lines · 1.9 KiB

1
2PACKAGE := abuild
3VERSION := 2.0_rc8
4
5prefix ?= /usr
6sysconfdir ?= /etc
7datadir ?= $(prefix)/share/$(PACKAGE)
8apkcache ?= ~/.cache/apks
9
10SCRIPTS := abuild devbuild mkalpine buildrepo abuild-keygen abuild-sign
11USR_BIN_FILES := $(SCRIPTS) abuild-tar
12SAMPLES := sample.APKBUILD sample.initd sample.confd \
13 sample.pre-install sample.post-install
14
15SCRIPT_SOURCES := $(addsuffix .in,$(SCRIPTS))
16
17DISTFILES=$(SCRIPT_SOURCES) $(SAMPLES) Makefile abuild.conf
18
19GIT_REV := $(shell test -d .git && git describe || echo exported)
20ifneq ($(GIT_REV), exported)
21FULL_VERSION := $(patsubst $(PACKAGE)-%,%,$(GIT_REV))
22FULL_VERSION := $(patsubst v%,%,$(FULL_VERSION))
23else
24FULL_VERSION := $(VERSION)
25endif
26
27SED := sed
28TAR := tar
29
30SED_REPLACE := -e 's:@VERSION@:$(FULL_VERSION):g' \
31 -e 's:@prefix@:$(prefix):g' \
32 -e 's:@sysconfdir@:$(sysconfdir):g' \
33 -e 's:@datadir@:$(datadir):g' \
34 -e 's:@apkcache@:$(apkcache):g'
35
36SSL_LIBS := $(shell pkg-config --libs openssl)
37
38.SUFFIXES: .sh.in .in
39.sh.in.sh:
40 ${SED} ${SED_REPLACE} ${SED_EXTRA} $< > $@
41
42.in:
43 ${SED} ${SED_REPLACE} ${SED_EXTRA} $< > $@
44
45P=$(PACKAGE)-$(VERSION)
46
47all: $(USR_BIN_FILES)
48
49clean:
50 @rm -f $(USR_BIN_FILES)
51
52abuild-tar: abuild-tar.c
53 $(CC) -o $@ $(SSL_LIBS) $^
54
55help:
56 @echo "$(P) makefile"
57 @echo "usage: make install [ DESTDIR=<path> ]"
58 @echo " make dist"
59
60install: $(USR_BIN_FILES) $(SAMPLES) abuild.conf functions.sh
61 mkdir -p $(DESTDIR)/$(prefix)/bin $(DESTDIR)/$(sysconfdir) \
62 $(DESTDIR)/$(datadir)
63 for i in $(USR_BIN_FILES); do\
64 install -m 755 $$i $(DESTDIR)/$(prefix)/bin/$$i;\
65 done
66 if [ -n "$(DESTDIR)" ] || [ ! -f "/$(sysconfdir)"/abuild.conf ]; then\
67 cp abuild.conf $(DESTDIR)/$(sysconfdir)/; \
68 fi
69 cp $(SAMPLES) $(DESTDIR)/$(prefix)/share/abuild
70 cp functions.sh $(DESTDIR)/$(datadir)/
71
72dist: $(P).tar.bz2
73
74$(P).tar.bz2: $(DISTFILES)
75 rm -rf $(P)
76 mkdir -p $(P)
77 cp $(DISTFILES) $(P)/
78 tar -cjf $@ $(P)
79 rm -rf $(P)
80
81.PHONY: install dist