abuild/Makefile

77 lines
1.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
2009-07-13 11:28:37 +00:00
VERSION := 1.16
2008-10-18 08:09:24 +00:00
2009-06-03 11:24:29 +00:00
prefix ?= /usr
sysconfdir ?= /etc
datadir ?= $(prefix)/share/$(PACKAGE)
apkcache ?= ~/.cache/apks
2008-10-18 08:09:24 +00:00
2009-05-08 13:33:34 +00:00
USR_BIN_FILES := abuild devbuild mkalpine buildrepo
SAMPLES := sample.APKBUILD sample.initd sample.confd \
sample.pre-install sample.post-install
SCRIPTS := $(USR_BIN_FILES)
SCRIPT_SOURCES := $(addsuffix .in,$(SCRIPTS))
DISTFILES=$(SCRIPT_SOURCES) $(SAMPLES) Makefile abuild.conf
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
SED := sed
TAR := tar
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:@apkcache@:$(apkcache):g'
2009-05-08 13:33:34 +00:00
.SUFFIXES: .sh.in .in
.sh.in.sh:
${SED} ${SED_REPLACE} ${SED_EXTRA} $< > $@
.in:
${SED} ${SED_REPLACE} ${SED_EXTRA} $< > $@
2008-10-18 08:09:24 +00:00
P=$(PACKAGE)-$(VERSION)
2009-05-08 13:33:34 +00:00
all: $(SCRIPTS)
2008-10-18 08:09:24 +00:00
help:
@echo "$(P) makefile"
@echo "usage: make install [ DESTDIR=<path> ]"
@echo " make dist"
install: $(USR_BIN_FILES) $(SAMPLES) abuild.conf functions.sh
2008-10-30 15:55:25 +00:00
mkdir -p $(DESTDIR)/$(prefix)/bin $(DESTDIR)/$(sysconfdir) \
2009-01-03 10:05:12 +00:00
$(DESTDIR)/$(datadir)
for i in $(USR_BIN_FILES); do\
install -m 755 $$i $(DESTDIR)/$(prefix)/bin/$$i;\
done
if [ -n "$(DESTDIR)" ] || [ ! -f "/$(sysconfdir)"/abuild.conf ]; then\
cp abuild.conf $(DESTDIR)/$(sysconfdir)/; \
fi
cp $(SAMPLES) $(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
dist: $(P).tar.bz2
2008-10-18 08:09:24 +00:00
$(P).tar.bz2: $(DISTFILES)
2008-10-18 08:09:24 +00:00
rm -rf $(P)
mkdir -p $(P)
cp $(DISTFILES) $(P)/
tar -cjf $@ $(P)
2008-10-18 08:09:24 +00:00
rm -rf $(P)
.PHONY: install dist