-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
69 lines (55 loc) · 1.55 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
67
68
69
PACKAGE := pcpp
VERSION := 0.11
AUTHOR := R.Jaksa 2008,2024 GPLv3
SUBVERSION :=
SHELL := /bin/bash
PATH := usr/bin:$(PATH)
PKGNAME := $(PACKAGE)-$(VERSION)$(SUBVERSION)
PROJECT := $(shell getversion -prj)
DATE := $(shell date '+%Y-%m-%d')
BIN := pcpp uninclude
DEP := $(BIN:%=.%.d)
DOC := $(BIN:%=%.md)
all: $(BIN) $(DOC)
$(BIN): %: %.pl .%.d .version.pl .%.built.pl Makefile
@echo -e '#!/usr/bin/perl' > $@
@echo -e "# $@ generated from $(PKGNAME)/$< $(DATE)" >> $@
usr/bin/pcpp $< >> $@
@chmod 755 $@
@sync # to ensure pcpp is saved before used in the next rule
@echo
$(DEP): .%.d: %.pl
pcpp -d $(<:%.pl=%) $< > $@
$(DOC): %.md: %
./$* -h | man2md > $@
.version.pl: Makefile
@echo 'our $$PACKAGE = "$(PACKAGE)";' > $@
@echo 'our $$VERSION = "$(VERSION)";' >> $@
@echo 'our $$AUTHOR = "$(AUTHOR)";' >> $@
@echo 'our $$SUBVERSION = "$(SUBVERSION)";' >> $@
@echo "make $@"
.PRECIOUS: .%.built.pl
.%.built.pl: %.pl .version.pl Makefile
@echo 'our $$BUILT = "$(DATE)";' > $@
@echo "make $@"
# /map install, requires /map directory and getversion and mapinstall tools
ifneq ($(wildcard /map),)
install: $(BIN) $(DOC) README.md
mapinstall -v /box/$(PROJECT)/$(PKGNAME) /map/$(PACKAGE) bin $(BIN)
mapinstall -v /box/$(PROJECT)/$(PKGNAME) /map/$(PACKAGE) doc $(DOC) README.md
# /usr/local install
else
install: $(BIN)
install $(BIN) /usr/local/bin
endif
# copy current pcpp to local usr/bin
copy:
cp pcpp usr/bin
clean:
rm -f .version.pl
rm -f .*.built.pl
rm -f $(DEP)
mrproper: clean
rm -rf $(DOC) $(BIN)
-include $(DEP)
-include ~/.github/Makefile.git