summaryrefslogtreecommitdiffstats
path: root/Makefile
blob: c359f90409b6f8f9bef0a8f042404359878a2a7a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
TWEAKS = $(PWD)/tweaks
PKGS = $(PWD)/pkg
BIN = $(PWD)/bin
PKGVAR = $(PWD)/var

.PHONY: checkpkgarg package tweakmeta PKGBUILD

package: $(PKGS)/$(PKG)/PKGBUILD
#	cd "$(PKGS)/$(PKG)"; makepkg --clean

PKGBUILD: $(PKGS)/$(PKG)/PKGBUILD

$(PKGS)/$(PKG)/PKGBUILD: tweakmeta
	@cd '$(PKGS)/$(PKG)'; \
	TDIR='$(BIN)/templ' $(BIN)/makepkgbuild
	@echo 'Built pkg/$(PKG)/PKGBUILD.'

tweakmeta: $(PKGS)/$(PKG)/PKGMETA
	@if [ -r '$(TWEAKS)/$(PKG)' ]; \
	then \
		cd '$(PKGS)/$(PKG)'; \
		$(BIN)/tweakmeta >PKGMETA.new <'$(TWEAKS)/$(PKG)'; \
		mv PKGMETA PKGMETA.old; \
		mv PKGMETA.new PKGMETA; \
		echo 'Tweaked PKGMETA with tweaks/$(PKG).'; \
	fi

$(PKGS)/$(PKG)/PKGMETA: prepare
	@[ -d '$(PKGS)/$(PKG)' ] || mkdir '$(PKGS)/$(PKG)'
	@cd '$(PKGS)/$(PKG)'; \
		PATH="$$PATH:$(BIN)" METABIN="$(BIN)/metas" \
		PKGVAR="$(PKGVAR)" \
		$(BIN)/makepkgmeta $(PKG) >PKGMETA
	@echo 'Created pkg/$(PKG)/PKGMETA.'

prepare:
	@case '$(PKG)' in \
	'') echo 'error: Specify the package name in the PKG variable.' 1>&2 ;\
	   false ;; \
	esac
	@[ -d var ] || mkdir var