-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
66 lines (53 loc) · 1.52 KB
/
Makefile
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
PACKAGE := subrelease
VERSION := 0.12
AUTHORS := R.Jaksa 2001,2021,2023 GPLv3
SUBVERS := c
SHELL := /bin/bash
PATH := usr/bin:$(PATH)
PKGNAME := $(PACKAGE)-$(VERSION)$(SUBVERSION)
PROJECT := $(shell getversion -prj)
DATE := $(shell date '+%Y-%m-%d')
BIN := getversion subrelease
DEP := $(BIN:%=.%.d)
DOC := $(BIN:%=%.md)
all: $(BIN) $(DOC)
$(BIN): %: %.pl .%.d .version.pl .%.built.pl Makefile
@echo -e '#!/usr/bin/perl' > $@
@echo "# $@ generated from $(PKGNAME)/$< $(DATE)" >> $@
pcpp $< >> $@
@chmod 755 $@
@sync
$(DEP): .%.d: %.pl
pcpp -d $(<:%.pl=%) $< > $@
$(DOC): %.md: %
./$* -h | man2md > $@
.version.pl: Makefile
@echo 'our $$PACKAGE = "$(PACKAGE)";' > $@
@echo 'our $$VERSION = "$(VERSION)";' >> $@
@echo 'our $$AUTHOR = "$(AUTHORS)";' >> $@
@echo 'our $$SUBVERSION = "$(SUBVERS)";' >> $@
@echo "update $@"
.PRECIOUS: .%.built.pl
.%.built.pl: %.pl .version.pl Makefile
@echo 'our $$BUILT = "$(DATE)";' > $@
@echo "update $@"
# /map install, requires /map directory and getversion and mapinstall tools
ifneq ($(wildcard /map),)
install: $(BIN) subls
mapinstall -v /box/$(PROJECT)/$(PKGNAME) /map/$(PACKAGE) bin $^
mapinstall -v /box/$(PROJECT)/$(PKGNAME) /map/$(PACKAGE) doc $(DOC) README.md
mkdir -p /map/$(PACKAGE)/doc/img
mapinstall -v /box/$(PROJECT)/$(PKGNAME) /map/$(PACKAGE) doc/img img/*
# /usr/local install
else
install: $(BIN)
install $(BIN) /usr/local/bin
endif
clean:
rm -f .version.pl
rm -f .*.built.pl
rm -f $(DEP)
mrproper: clean
rm -f $(DOC) $(BIN)
-include $(DEP)
-include ~/.github/Makefile.git