projects/aports·blob v2.29.0 · refs

110 lines · 2.8 KiB

1
2PACKAGE := abuild
3VERSION := 2.29.0
4
5prefix ?= /usr
6bindir ?= $(prefix)/bin
7sysconfdir ?= /etc
8datadir ?= $(prefix)/share/$(PACKAGE)
9
10SCRIPTS := abuild abuild-keygen abuild-sign newapkbuild \
11 abump apkgrel buildlab apkbuild-cpan checkapk \
12 apkbuild-gem-resolver
13USR_BIN_FILES := $(SCRIPTS) abuild-tar abuild-sudo abuild-fetch
14SAMPLES := sample.APKBUILD sample.initd sample.confd \
15 sample.pre-install sample.post-install
16AUTOTOOLS_TOOLCHAIN_FILES := config.sub config.guess
17
18SCRIPT_SOURCES := $(addsuffix .in,$(SCRIPTS))
19
20GIT_REV := $(shell test -d .git && git describe || echo exported)
21ifneq ($(GIT_REV), exported)
22FULL_VERSION := $(patsubst $(PACKAGE)-%,%,$(GIT_REV))
23FULL_VERSION := $(patsubst v%,%,$(FULL_VERSION))
24else
25FULL_VERSION := $(VERSION)
26endif
27
28CHMOD := chmod
29SED := sed
30TAR := tar
31LINK = $(CC) $(OBJS-$@) -o $@ $(LDFLAGS) $(LDFLAGS-$@) $(LIBS-$@)
32
33SED_REPLACE := -e 's:@VERSION@:$(FULL_VERSION):g' \
34 -e 's:@prefix@:$(prefix):g' \
35 -e 's:@sysconfdir@:$(sysconfdir):g' \
36 -e 's:@datadir@:$(datadir):g' \
37
38SSL_CFLAGS ?= $(shell pkg-config --cflags openssl)
39SSL_LDFLAGS ?= $(shell pkg-config --cflags openssl)
40SSL_LIBS ?= $(shell pkg-config --libs openssl)
41
42
43OBJS-abuild-tar = abuild-tar.o
44CFLAGS-abuild-tar.o = $(SSL_CFLAGS)
45LDFLAGS-abuild-tar = $(SSL_LDFLAGS)
46LIBS-abuild-tar = $(SSL_LIBS)
47
48OBJS-abuild-sudo = abuild-sudo.o
49OBJS-abuild-fetch = abuild-fetch.o
50
51.SUFFIXES: .sh.in .in
52%.sh: %.sh.in
53 ${SED} ${SED_REPLACE} ${SED_EXTRA} $< > $@
54 ${CHMOD} +x $@
55
56%: %.in
57 ${SED} ${SED_REPLACE} ${SED_EXTRA} $< > $@
58 ${CHMOD} +x $@
59
60P=$(PACKAGE)-$(VERSION)
61
62all: $(USR_BIN_FILES) functions.sh
63
64clean:
65 @rm -f $(USR_BIN_FILES) functions.sh
66
67%.o: %.c
68 $(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS-$@) -o $@ -c $<
69
70abuild-sudo: abuild-sudo.o
71 $(LINK)
72
73abuild-tar: abuild-tar.o
74 $(LINK)
75
76abuild-fetch: abuild-fetch.o
77 $(LINK)
78
79abuild-tar.static: abuild-tar.o
80 $(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS-$@) -o $@ -static $(LIBS-$@) $^
81
82help:
83 @echo "$(P) makefile"
84 @echo "usage: make install [ DESTDIR=<path> ]"
85
86install: $(USR_BIN_FILES) $(SAMPLES) abuild.conf functions.sh
87 install -d $(DESTDIR)/$(bindir) $(DESTDIR)/$(sysconfdir) \
88 $(DESTDIR)/$(datadir)
89 for i in $(USR_BIN_FILES); do\
90 install -m 755 $$i $(DESTDIR)/$(bindir)/$$i;\
91 done
92 chmod 4111 $(DESTDIR)/$(prefix)/bin/abuild-sudo
93 for i in adduser addgroup apk; do \
94 ln -fs abuild-sudo $(DESTDIR)/$(bindir)/abuild-$$i; \
95 done
96 if [ -n "$(DESTDIR)" ] || [ ! -f "/$(sysconfdir)"/abuild.conf ]; then\
97 cp abuild.conf $(DESTDIR)/$(sysconfdir)/; \
98 fi
99 cp $(SAMPLES) $(DESTDIR)/$(prefix)/share/abuild/
100 cp $(AUTOTOOLS_TOOLCHAIN_FILES) $(DESTDIR)/$(prefix)/share/abuild/
101 cp functions.sh $(DESTDIR)/$(datadir)/
102
103.gitignore: Makefile
104 echo "*.tar.bz2" > $@
105 for i in $(USR_BIN_FILES); do\
106 echo $$i >>$@;\
107 done
108
109
110.PHONY: install