-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile.am
167 lines (143 loc) · 4.3 KB
/
Makefile.am
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
#
## Copyright (C) 2001-2024 Graeme Walker <[email protected]>
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#
# Makefile.am
#
# Top-level makefile
#
# Additional pseudo-targets:
# * rpm - builds an rpm package using rpmbuild
# * deb - builds a deb package using debhelper
# * cmake - generates cmake files under ./build/
# * tidy - runs cmake-tidy
# * format - runs cmake-format
#
# Eg:
# $ dnf install g++ make automake openssl-devel pam-devel rpm-build # rpm
# $ ./bootstrap
# $ ./configure.sh
# $ make
# $ sudo make rpm
#
# or:
# $ apt install g++ make automake libssl-dev libpam0g-dev debhelper # deb
# $ ./bootstrap
# $ ./configure.sh
# $ make
# $ sudo make deb
#
# and possibly:
# $ make cmake ; make -C build
# $ make tidy TIDY=clang-tidy-10
# $ make format FORMAT=clang-format-10
# $ make distcheck DISTCHECK_CONFIGURE_FLAGS=--disable-testing
#
EXTRA_DIST = \
emailrelay.spec \
configure.sh \
ChangeLog \
LICENSE \
VERSION \
README.md \
README.rst \
bootstrap \
autogen.sh \
winbuild.bat \
winbuild.pl \
runperl.bat
SUBDIRS = libexec bin src etc doc debian test m4 bsd po unity
# work-round PKG_CHECK_MODULES if no pkg-config
ACLOCAL_AMFLAGS = -I m4
e_doc_DATA = COPYING AUTHORS INSTALL NEWS README ChangeLog
uninstall-local:
-for try in 1 2 3 4 ; do echo "$(e_pamdir)/" "$(e_initdir)/" "$(e_sysconfdir)/" "$(e_examplesdir)/" "$(e_libexecdir)/" "$(e_spooldir)/" "$(e_docdir)/" "$(pkgdatadir)/" | tr ' ' '\n' | grep "/emailrelay/" | while read d ; do rmdir "$(DESTDIR)/$$d" 2>/dev/null ; done ; done
RPM_ROOT ?= ${HOME}/rpmbuild
#ARCH ?= $(shell arch)
ARCH ?= x86_64
RPM=$(RPM_ROOT)/RPMS/$(ARCH)/emailrelay-$(VERSION)-1.$(ARCH).rpm
TAR=emailrelay-$(VERSION).tar.gz
ZIP=emailrelay-$(VERSION)-src.zip
DEB=emailrelay_$(VERSION)_$(ARCH).deb
.PHONY: strip
strip:
$(MAKE) -C src/main strip
.PHONY: rpm
rpm: $(RPM)
$(RPM): dist
-rm -rf $(RPM_ROOT)/BUILD/emailrelay-$(VERSION)-1.$(ARCH)
test ! -d $(RPM_ROOT)/BUILD/emailrelay-$(VERSION)-1.$(ARCH)
-mkdir -p $(RPM_ROOT)/BUILD $(RPM_ROOT)/SOURCES $(RPM_ROOT)/SPECS 2>/dev/null
cp $(TAR) $(RPM_ROOT)/SOURCES/emailrelay-$(VERSION)-src.tar.gz
cp $(top_srcdir)/emailrelay.spec $(RPM_ROOT)/SPECS/
-chown root:root $(RPM_ROOT)/SPECS/emailrelay.spec
-rm -f $(RPM)
test ! -f $(RPM)
rpmbuild -ba $(RPM_ROOT)/SPECS/emailrelay.spec
test -f $(RPM)
.PHONY: deb
deb: $(DEB)
$(DEB): dist
-mv emailrelay-$(VERSION) emailrelay-$(VERSION).old.$$$$ || true
tar -xzf $(TAR)
cd emailrelay-$(VERSION) && fakeroot debian/rules binary # or dpkg-buildpackage -b --jobs=10
mkdir emailrelay-$(VERSION)/debian/source
.PHONY: deb-src
deb-src: dist
-mv emailrelay-$(VERSION) emailrelay-$(VERSION).old.$$$$ || true
tar -xzf $(TAR)
mkdir emailrelay-$(VERSION)/debian/source
echo 1.0 > emailrelay-$(VERSION)/debian/source/format
dpkg-source --build emailrelay-$(VERSION)
.PHONY: tidy
tidy:
$(MAKE) -C unity tidy
.PHONY: unity
unity:
$(MAKE) -C unity unity
.PHONY: small
small:
$(MAKE) -C unity small
.PHONY: format
format:
$(MAKE) -C src format
.PHONY: cmake
cmake:
@chmod +x libexec/make2cmake || true
libexec/make2cmake
test -d build || mkdir build
cd build && cmake -DCMAKE_MAKE_PROGRAM:FILEPATH=/usr/bin/make -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..
@echo now run make from the '"build"' directory
.PHONY: qmake
qmake:
@chmod +x libexec/make2qmake || true
libexec/make2qmake
.PHONY: tar
tar: $(TAR)
$(TAR):
$(MAKE) dist
.PHONY: zip
zip: $(ZIP)
$(ZIP): $(TAR)
-mkdir makezip.tmp 2>/dev/null
-@rm -rf makezip.tmp/* 2>/dev/null
tar -C makezip.tmp --strip-components=1 -xzf $(TAR)
sh -c "cd makezip.tmp && zip -r ../$(ZIP) ."
.PHONY: mbedtls
mbedtls:
test -d mbedtls || git clone https://salsa.debian.org/debian/mbedtls.git
make -C mbedtls/library WINDOWS=0
-@echo now run ./configure.sh