File: Makefile

package info (click to toggle)
debmake-doc 1.17-7
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 24,612 kB
  • sloc: makefile: 768; sh: 690; ansic: 114; python: 99; sed: 16
file content (144 lines) | stat: -rw-r--r-- 4,790 bytes parent folder | download
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# Build all Debian packaging examples
# Copyright (C) 2021 Osamu Aoki

# Normalize build environment (Debian default is LANG=C etc.)
LC_ALL := C.UTF-8
export LC_ALL
TERM = dumb
export TERM
ARCH := $(shell dpkg-architecture -q DEB_TARGET_ARCH)

ALL_DIRS := $(shell find . -maxdepth 1 -type d -regex '\./debhello-.*' | sed  -e 's,^\./,,')
BUILD_DIRS := $(shell find . -maxdepth 1 -type d -regex '\./debhello-.*_build.*' | sed  -e 's,^\./,,')
UPSTREAM_DIRS := $(filter-out $(BUILD_DIRS),$(ALL_DIRS))
TARGZS := $(addsuffix .tar.gz, $(UPSTREAM_DIRS))
ORIGTARGZS := $(patsubst debhello-%,debhello_%,$(addsuffix .orig.tar.gz, $(UPSTREAM_DIRS)))
BUILDMAKEFILES := $(addsuffix /Makefile, $(BUILD_DIRS))
BUILDSTAMPS := $(addsuffix -stamp, $(BUILD_DIRS))

all: prep
	# === BUILDSTAMPS ===
	$(MAKE) $(BUILDSTAMPS)
	# === SUCCESS ALL ===
prep:
	# === ALL_DIRS ===
	@ echo "$(ALL_DIRS)"| xargs -n1
	# === BUILD_DIRS ===
	@ echo "$(BUILD_DIRS)"| xargs -n1
	# === UPSTREAM_DIRS ===
	@ echo "$(UPSTREAM_DIRS)" | xargs -n1
	# === TARGZS ===
	@ echo "$(TARGZS)" | xargs -n1
	$(MAKE) $(TARGZS)
	# === ORIGTARGZS ===
	@ echo "$(ORIGTARGZS)" | xargs -n1
	$(MAKE) $(ORIGTARGZS)
	# === BUILDMAKEFILES ===
	$(MAKE) $(BUILDMAKEFILES)
	# === SUCCESS PREP ===
clean:
	-rm -f $(TARGZS)
	-rm -f $(ORIGTARGZS)
	-rm -f $(BUILDMAKEFILES)
	-rm -f $(BUILDSTAMPS)
	# way to clean build results and Makefile link
	-rm -f debhello-*_build*/*.log
	-rm -f debhello-*_build*/Makefile
	-rm -f debhello-*_build*/next.dir
	-rm -f debhello-*_build*/project
	-rm -rf debhello-*_build*/test
	# post-debmake snapshot of test
	-rm -rf debhello-*_build*/debmake
	# post-package snapshot of test
	-rm -rf debhello-*_build*/package

distclean: clean
	-rm -f debhello-*_build*/*.slog

debhello-%.tar.gz: debhello-%/LICENSE
	tar --exclude=debhello-$*/debian -cvzf $@ debhello-$*/

debhello_%.orig.tar.gz: debhello-%.tar.gz
	ln -sf $^ $@

debhello-%/Makefile: template/Makefile
	ln -sf ../$^ $@

debhello-%-stamp: debhello-%/Makefile
	$(MAKE) -C debhello-$*

#######################################################################
# Groom debhello-*/debian/* template files
#######################################################################
VERSIONS := $(patsubst debhello-%,%,$(UPSTREAM_DIRS))
CHANGELOGS := $(addsuffix /debian/changelog, $(addprefix debhello-,$(VERSIONS)))
COPYRIGHTS := $(addsuffix /debian/copyright, $(addprefix debhello-,$(VERSIONS)))
COPYRIGHTS := $(addsuffix /debian/control, $(addprefix debhello-,$(VERSIONS)))
READMES := $(addsuffix /debian/README.Debian, $(addprefix debhello-,$(VERSIONS)))
WATCHS := $(addsuffix /debian/watch, $(addprefix debhello-,$(VERSIONS)))
SRCF := $(addsuffix /debian/source/format, $(addprefix debhello-,$(VERSIONS)))
WRAPS := $(addsuffix -wrap,$(addprefix debhello-,$(VERSIONS)))

vers:
	# === VERSIONS ===
	@ echo "$(VERSIONS)"| xargs -n1

groom:
	cd template ; touch * source/*
	$(MAKE) $(CHANGELOGS) $(COPYRIGHTS) $(READMES) $(WATCHS) $(SRCF) $(CONTROLS)
	# clean whitespaces in line tail (exclude some directories)
	-find . -type d \
		-regex ".*/\.git" -prune -o \
		-regex ".*/post-gettextize" -prune -o \
		-regex ".*/png" -prune -o \
	       -type f -exec sed -i -e 's/[ \t]*$$//' '{}' \;
	$(MAKE) $(WRAPS)

debhello-%/debian/changelog: template/changelog
	mkdir -p debhello-$*/debian
	sed -ne '/debhello ($*-1/,$$p' <$^ >$@

debhello-%/debian/copyright: template/copyright
	mkdir -p debhello-$*/debian
	cp -f $^ $@

# Standards-Version: 4.5.1
# Homepage: <insert the upstream URL, if relevant>
# Homepage: https://salsa.debian.org/debian/debmake-doc
# Vcs-Git: https://salsa.debian.org/debian/debmake-doc.git
# Vcs-Browser: https://salsa.debian.org/debian/debmake-doc
HOMEPAGE = https://salsa.debian.org/debian/debmake-doc
STDVER = 4.5.1
DHCOMPAT = 13
MAINTNM = Osamu Aoki <osamu@debian.org>

debhello-%/debian/control: template/README.Debian
	mkdir -p debhello-$*/debian
	sed -i  \
		-e 's/^Section: unknown$$/Section: devel/' \
		-e 's/^Maintainer:.*$$/Maintainer: $(MAINTNM)/' \
		-e 's/debhelper-compat *( *= *[1-9][0-9]* *)/debhelper-compat (= $(DHCOMPAT))/' \
		-e 's/^Standards-Version:.*$$/Standards-Version: $(STDVER)/' \
		-e 's,^Homepage:.*$$,Homepage: $(HOMEPAGE),' \
		-e 's,^Description:.*$$,Description: Simple packaging example for debmake,' \
		-e 's,was auto-generated.*$$,is an example package.,' \
		-e 's,^ debmake(1) command provided by .*$$, (This is an example only),' \
		-e 's,^X-Python3-Version.*$$,,' \
		$@

debhello-%/debian/README.Debian: template/README.Debian
	mkdir -p debhello-$*/debian
	cp -f $^ $@

debhello-%/debian/watch: template/watch
	mkdir -p debhello-$*/debian
	cp -f $^ $@

debhello-%/debian/source/format: template/source/format
	mkdir -p debhello-$*/debian/source
	cp -f $^ $@

debhello-%-wrap:
	cd debhello-$* ; \
	wrap-and-sort