From 3d79fb7036e5c42fbe00689f78c222fe66a22a44 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Fri, 8 May 2009 13:33:34 +0000 Subject: use .in files for scripts --- Makefile | 47 +++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 39 insertions(+), 8 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 9e89c77..b284d47 100644 --- a/Makefile +++ b/Makefile @@ -1,18 +1,50 @@ -PACKAGE=abuild -VERSION:=$(shell awk -F= '$$1 == "abuild_ver" {print $$2}' abuild) -USR_BIN_FILES=abuild devbuild mkalpine buildrepo -SAMPLES=sample.APKBUILD sample.initd sample.confd sample.pre-install \ - sample.post-install -DISTFILES=$(USR_BIN_FILES) $(SAMPLES) Makefile abuild.conf initramfs-init \ - +PACKAGE := abuild +VERSION := 1.14 prefix ?= /usr sysconfdir ?= /etc datadir ?= $(prefix)/share/$(PACKAGE) +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' \ + -e 's:@datadir@:$(datadir):g' + +.SUFFIXES: .sh.in .in +.sh.in.sh: + ${SED} ${SED_REPLACE} ${SED_EXTRA} $< > $@ + +.in: + ${SED} ${SED_REPLACE} ${SED_EXTRA} $< > $@ + + + + P=$(PACKAGE)-$(VERSION) +all: $(SCRIPTS) + help: @echo "$(P) makefile" @echo "usage: make install [ DESTDIR= ]" @@ -29,7 +61,6 @@ install: $(USR_BIN_FILES) $(SAMPLES) abuild.conf functions.sh fi cp $(SAMPLES) $(DESTDIR)/$(prefix)/share/abuild cp functions.sh $(DESTDIR)/$(datadir)/ - cp initramfs-init $(DESTDIR)/$(datadir)/ dist: $(P).tar.bz2 -- cgit v1.2.3