abuild/Makefile

112 lines
2.7 KiB
Makefile
Raw Normal View History

2008-10-18 08:09:24 +00:00
2009-05-08 13:33:34 +00:00
PACKAGE := abuild
2015-10-28 16:02:33 +00:00
VERSION := 2.25.0_rc1
2008-10-18 08:09:24 +00:00
2009-06-03 11:24:29 +00:00
prefix ?= /usr
bindir ?= $(prefix)/bin
2009-06-03 11:24:29 +00:00
sysconfdir ?= /etc
datadir ?= $(prefix)/share/$(PACKAGE)
abuildrepo ?= ~/.cache/abuild
2008-10-18 08:09:24 +00:00
SCRIPTS := abuild abuild-keygen abuild-sign newapkbuild \
2014-12-08 15:56:25 +00:00
abump apkgrel buildlab apkbuild-cpan checkapk \
apkbuild-gem-resolver
USR_BIN_FILES := $(SCRIPTS) abuild-tar abuild-sudo abuild-fetch
2009-05-08 13:33:34 +00:00
SAMPLES := sample.APKBUILD sample.initd sample.confd \
sample.pre-install sample.post-install
AUTOTOOLS_TOOLCHAIN_FILES := config.sub
2009-05-08 13:33:34 +00:00
SCRIPT_SOURCES := $(addsuffix .in,$(SCRIPTS))
GIT_REV := $(shell test -d .git && git describe || echo exported)
ifneq ($(GIT_REV), exported)
FULL_VERSION := $(patsubst $(PACKAGE)-%,%,$(GIT_REV))
FULL_VERSION := $(patsubst v%,%,$(FULL_VERSION))
else
FULL_VERSION := $(VERSION)
endif
CHMOD := chmod
2009-05-08 13:33:34 +00:00
SED := sed
TAR := tar
LINK = $(CC) $(OBJS-$@) -o $@ $(LDFLAGS) $(LDFLAGS-$@) $(LIBS-$@)
2009-05-08 13:33:34 +00:00
SED_REPLACE := -e 's:@VERSION@:$(FULL_VERSION):g' \
-e 's:@prefix@:$(prefix):g' \
-e 's:@sysconfdir@:$(sysconfdir):g' \
2009-06-03 11:24:29 +00:00
-e 's:@datadir@:$(datadir):g' \
-e 's:@abuildrepo@:$(abuildrepo):g'
2009-05-08 13:33:34 +00:00
SSL_CFLAGS = $(shell pkg-config --cflags openssl)
SSL_LIBS = $(shell pkg-config --libs openssl)
LDFLAGS ?=
OBJS-abuild-tar = abuild-tar.o
LIBS-abuild-tar = $(SSL_LIBS)
CFLAGS-abuild-tar = $(SSL_CFLAGS)
OBJS-abuild-sudo = abuild-sudo.o
OBJS-abuild-fetch = abuild-fetch.o
2009-05-08 13:33:34 +00:00
.SUFFIXES: .sh.in .in
%.sh: %.sh.in
2009-05-08 13:33:34 +00:00
${SED} ${SED_REPLACE} ${SED_EXTRA} $< > $@
${CHMOD} +x $@
2009-05-08 13:33:34 +00:00
%: %.in
2009-05-08 13:33:34 +00:00
${SED} ${SED_REPLACE} ${SED_EXTRA} $< > $@
${CHMOD} +x $@
2009-05-08 13:33:34 +00:00
P=$(PACKAGE)-$(VERSION)
2009-05-08 13:33:34 +00:00
all: $(USR_BIN_FILES) functions.sh
2009-05-08 13:33:34 +00:00
clean:
@rm -f $(USR_BIN_FILES) functions.sh
2009-05-08 13:33:34 +00:00
%.o: %.c
2013-07-05 14:28:28 +00:00
$(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS-$@) -o $@ -c $<
abuild-sudo: abuild-sudo.o
$(LINK)
abuild-tar: abuild-tar.o
$(LINK)
abuild-fetch: abuild-fetch.o
$(LINK)
abuild-tar.static: abuild-tar.o
2013-07-05 14:28:28 +00:00
$(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS-$@) -o $@ -static $(LIBS-$@) $^
2009-05-08 13:33:34 +00:00
2008-10-18 08:09:24 +00:00
help:
@echo "$(P) makefile"
@echo "usage: make install [ DESTDIR=<path> ]"
install: $(USR_BIN_FILES) $(SAMPLES) abuild.conf functions.sh
install -d $(DESTDIR)/$(bindir) $(DESTDIR)/$(sysconfdir) \
2009-01-03 10:05:12 +00:00
$(DESTDIR)/$(datadir)
for i in $(USR_BIN_FILES); do\
install -m 755 $$i $(DESTDIR)/$(bindir)/$$i;\
done
chmod 4111 $(DESTDIR)/$(prefix)/bin/abuild-sudo
for i in adduser addgroup apk; do \
ln -fs abuild-sudo $(DESTDIR)/$(bindir)/abuild-$$i; \
done
if [ -n "$(DESTDIR)" ] || [ ! -f "/$(sysconfdir)"/abuild.conf ]; then\
cp abuild.conf $(DESTDIR)/$(sysconfdir)/; \
fi
cp $(SAMPLES) $(DESTDIR)/$(prefix)/share/abuild/
cp $(AUTOTOOLS_TOOLCHAIN_FILES) $(DESTDIR)/$(prefix)/share/abuild/
2009-01-03 10:05:12 +00:00
cp functions.sh $(DESTDIR)/$(datadir)/
2008-10-18 08:09:24 +00:00
2010-11-19 10:30:07 +00:00
.gitignore: Makefile
echo "*.tar.bz2" > $@
for i in $(USR_BIN_FILES); do\
echo $$i >>$@;\
done
.PHONY: install