-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
Makefile.in
253 lines (214 loc) · 6.36 KB
/
Makefile.in
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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
#
# Makefile for LPrint, a Label Printer Application
#
# Copyright © 2019-2024 by Michael R Sweet
#
# Licensed under Apache License v2.0. See the file "LICENSE" for more
# information.
#
# Be silent...
.SILENT:
# Version number...
LPRINT_VERSION = @LPRINT_VERSION@
# Languages we have localized messages for...
LANGUAGES = de en es fr it
# Programs and options...
AR = @AR@
ARFLAGS = @ARFLAGS@
ASAN_OPTIONS = leak_check_at_exit=false
CC = @CC@
CFLAGS = -I.. @CFLAGS@ $(CPPFLAGS) $(OPTIM) $(WARNINGS)
CPPFLAGS = @CPPFLAGS@
CSFLAGS = -s "$${CODESIGN_IDENTITY:=-}" --timestamp @CSFLAGS@
INSTALL = @INSTALL@
LDFLAGS = @LDFLAGS@ $(OPTIM)
LIBS = @LIBS@ -lm
MKDIR = @MKDIR@ -p
OPTIM = @OPTIM@
RANLIB = @RANLIB@
RM = @RM@ -f
RMDIR = @RMDIR@
SHELL = /bin/sh
WARNINGS = @WARNINGS@
# Directories...
bindir = @bindir@
datadir = @datadir@
datarootdir = @datarootdir@
exec_prefix = @exec_prefix@
includedir = @includedir@
infodir = @infodir@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
oldincludedir = @oldincludedir@
prefix = @prefix@
privateinclude = @privateinclude@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
top_srcdir = @top_srcdir@
unitdir = @unitdir@
BUILDROOT = $(DSTROOT)$(RPM_BUILD_ROOT)$(DESTDIR)
# Build commands...
.c.o:
echo Compiling $<...
$(CC) $(CFLAGS) -c -o $@ $<
# Targets...
MAN1 = \
man/lprint-add.1 \
man/lprint-cancel.1 \
man/lprint-default.1 \
man/lprint-delete.1 \
man/lprint-devices.1 \
man/lprint-drivers.1 \
man/lprint-jobs.1 \
man/lprint-modify.1 \
man/lprint-options.1 \
man/lprint-printers.1 \
man/lprint-server.1 \
man/lprint-shutdown.1 \
man/lprint-status.1 \
man/lprint-submit.1 \
man/lprint.1
MAN5 = \
man/lprint.conf.5
OBJS = \
lprint.o \
lprint-brother.o \
lprint-common.o \
lprint-cpcl.o \
lprint-dymo.o \
lprint-epl2.o \
lprint-sii.o \
lprint-testpage.o \
lprint-tspl.o \
lprint-zpl.o
TARGETS = \
lprint
TESTOBJS = \
testdither.o \
testpackbits.o
TESTTARGETS = \
testdither \
testpackbits
# Make everything...
all: $(TARGETS)
# Clean everything...
clean:
$(RM) $(TARGETS) $(OBJS) $(TESTTARGETS) $(TESTOBJS)
# Clean everything and generated files
distclean: clean
$(RM) -r autom4te.cache
$(RM) config.h config.log config.status
$(RM) Makefile
# Install everything...
install: all
echo "Installing lprint to $(BUILDROOT)$(bindir)..."
$(INSTALL) -d -m 755 $(BUILDROOT)$(bindir)
$(INSTALL) -c -m 755 lprint $(BUILDROOT)$(bindir)
echo "Installing man pages to $(BUILDROOT)$(mandir)..."
$(INSTALL) -d -m 755 $(BUILDROOT)$(mandir)/man1
for file in $(MAN1); do \
$(INSTALL) -c -m 644 $$file $(BUILDROOT)$(mandir)/man1; \
done
$(INSTALL) -d -m 755 $(BUILDROOT)$(mandir)/man5
for file in $(MAN5); do \
$(INSTALL) -c -m 644 $$file $(BUILDROOT)$(mandir)/man5; \
done
if test `uname` = Darwin; then \
echo "Installing launchd service to $(BUILDROOT)/Library/LaunchDaemons..."; \
$(INSTALL) -d -m 755 $(BUILDROOT)/Library/LaunchDaemons; \
$(INSTALL) -c -m 644 org.msweet.lprint.plist $(BUILDROOT)/Library/LaunchDaemons; \
elif test "x$(unitdir)" != x; then \
echo "Installing systemd service to $(BUILDROOT)$(unitdir)..."; \
$(INSTALL) -d -m 755 $(BUILDROOT)$(unitdir); \
$(INSTALL) -c -m 644 lprint.service $(BUILDROOT)$(unitdir); \
fi
# Test everything...
test: $(TARGETS) $(TESTTARGETS)
date >test.log
echo "Running testpackbits..."
./testpackbits 2>>test.log
# LPrint program...
lprint: $(OBJS)
echo Linking $@...
$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
if test `uname` = Darwin; then \
echo "Code-signing $@..."; \
codesign $(CSFLAGS) -i org.msweet.lprint $@; \
fi
# Dither test program...
testdither: testdither.o lprint-common.o
echo Linking $@...
$(CC) $(LDFLAGS) -o $@ testdither.o lprint-common.o $(LIBS)
if test `uname` = Darwin; then \
echo "Code-signing $@..."; \
codesign $(CSFLAGS) -i org.msweet.testdither $@; \
fi
# Packbits test program...
testpackbits: testpackbits.o lprint-common.o
echo Linking $@...
$(CC) $(LDFLAGS) -o $@ testpackbits.o lprint-common.o $(LIBS)
if test `uname` = Darwin; then \
echo "Code-signing $@..."; \
codesign $(CSFLAGS) -i org.msweet.testpackbits $@; \
fi
# Generate resource headers from the corresponding files in the resource
# directory...
resheaders:
for file in lprint lprint-large lprint-small; do \
echo "Generating $$file-png.h from $$file.png..."; \
pappl-makeresheader static-resources/$$file.png >static-resources/$$file-png.h; \
done
echo "Generating lprint-css.h from lprint.css..."
pappl-makeresheader static-resources/lprint.css >static-resources/lprint-css.h
for lang in $(LANGUAGES); do \
echo "Generating lprint-$$lang-strings.h from lprint-$$lang.strings..."; \
pappl-makeresheader static-resources/lprint-$$lang.strings >static-resources/lprint-$$lang-strings.h; \
done
# Dependencies...
$(OBJS) $(TESTOBJS): config.h lprint.h Makefile
lprint.o: \
lprint-brother.h \
lprint-cpcl.h \
lprint-dymo.h \
lprint-epl2.h \
lprint-sii.h \
lprint-tspl.h \
lprint-zpl.h \
static-resources/lprint-css.h \
static-resources/lprint-png.h \
static-resources/lprint-large-png.h \
static-resources/lprint-small-png.h \
static-resources/lprint-de-strings.h \
static-resources/lprint-en-strings.h \
static-resources/lprint-es-strings.h \
static-resources/lprint-fr-strings.h \
static-resources/lprint-it-strings.h
# Notarize the lprint executable and make the macOS package...
#
# Set the APPLEID, CODESIGN_IDENTITY, PKGSIGN_IDENTITY, and TEAMID environment
# variables from the Apple developer pages.
macos:
echo "Creating archive for notarization..."
rm -f lprint.zip
zip -v9 lprint.zip lprint
echo Notarizing application
xcrun notarytool submit lprint.zip \
--apple-id "$${APPLEID}" \
--keychain-profile "AC_$${TEAMID}" \
--team-id "$${TEAMID}" \
--wait
rm -f lprint.zip
echo "Creating the macOS package..."
rm -rf /private/tmp/lprint-$(LPRINT_VERSION)
make BUILDROOT="/private/tmp/lprint-$(LPRINT_VERSION)" install
pkgbuild --root /private/tmp/lprint-$(LPRINT_VERSION) \
--identifier org.msweet.lprint \
--version $(LPRINT_VERSION) \
--scripts macos-scripts \
--min-os-version 11.0 \
--sign "$${PKGSIGN_IDENTITY}" --timestamp \
lprint-$(LPRINT_VERSION)-macos.pkg