]> git.ipfire.org Git - thirdparty/cups.git/blob - cgi-bin/Makefile
Merge pull request #5297 from FedericoYundt/patch-1
[thirdparty/cups.git] / cgi-bin / Makefile
1 #
2 # CGI makefile for CUPS.
3 #
4 # Copyright 2007-2017 by Apple Inc.
5 # Copyright 1997-2006 by Easy Software Products.
6 #
7 # Licensed under Apache License v2.0. See the file "LICENSE" for more information.
8 #
9
10 include ../Makedefs
11
12 LIBOBJS = \
13 help-index.o \
14 html.o \
15 ipp-var.o \
16 search.o \
17 template.o \
18 var.o
19 OBJS = \
20 $(LIBOBJS) \
21 admin.o \
22 classes.o \
23 help.o \
24 jobs.o \
25 makedocset.o \
26 printers.o \
27 testcgi.o \
28 testhi.o \
29 testtemplate.o
30 CGIS = \
31 admin.cgi \
32 classes.cgi \
33 help.cgi \
34 jobs.cgi \
35 printers.cgi
36 LIBTARGETS = \
37 libcupscgi.a \
38 $(LIBCUPSCGI)
39
40 UNITTARGETS = \
41 testcgi \
42 testhi \
43 testtemplate
44
45 TARGETS = \
46 $(LIBTARGETS) \
47 $(CGIS)
48
49
50 #
51 # Make all targets...
52 #
53
54 all: $(TARGETS)
55
56
57 #
58 # Make library targets...
59 #
60
61 libs: $(LIBTARGETS) $(UNITTESTS)
62
63
64 #
65 # Make unit tests...
66 #
67
68 unittests: $(UNITTARGETS)
69
70
71 #
72 # Clean all object files...
73 #
74
75 clean:
76 $(RM) $(OBJS) $(TARGETS) $(UNITTARGETS) makedocset
77 $(RM) libcupscgi.so libcupscgi.dylib
78
79
80 #
81 # Update dependencies (without system header dependencies...)
82 #
83
84 depend:
85 $(CC) -MM $(ALL_CFLAGS) $(OBJS:.o=.c) >Dependencies
86
87
88 #
89 # Install all targets...
90 #
91
92 install: all install-data install-headers install-libs install-exec
93
94
95 #
96 # Install data files...
97 #
98
99 install-data:
100
101
102 #
103 # Install programs...
104 #
105
106 install-exec:
107 $(INSTALL_DIR) -m 755 $(SERVERBIN)/cgi-bin
108 for file in $(CGIS); do \
109 $(INSTALL_BIN) $$file $(SERVERBIN)/cgi-bin; \
110 done
111 if test "x$(SYMROOT)" != "x"; then \
112 $(INSTALL_DIR) $(SYMROOT); \
113 for file in $(CGIS); do \
114 cp $$file $(SYMROOT); \
115 dsymutil $(SYMROOT)/$$file; \
116 done \
117 fi
118
119
120 #
121 # Install headers...
122 #
123
124 install-headers:
125 if test "x$(privateinclude)" != x; then \
126 echo Installing private header files into $(PRIVATEINCLUDE)...; \
127 $(INSTALL_DIR) -m 755 $(PRIVATEINCLUDE); \
128 for file in cgi.h help-index.h; do \
129 $(INSTALL_DATA) $$file $(PRIVATEINCLUDE); \
130 done; \
131 fi
132
133
134 #
135 # Install libraries...
136 #
137
138 install-libs: $(INSTALLSTATIC)
139 echo Installing libraries in $(LIBDIR)...
140 $(INSTALL_DIR) -m 755 $(LIBDIR)
141 $(INSTALL_LIB) $(LIBCUPSCGI) $(LIBDIR)
142 if test $(LIBCUPSCGI) = "libcupscgi.so.1"; then \
143 $(RM) $(LIBDIR)/`basename $(LIBCUPSCGI) .1`; \
144 $(LN) $(LIBCUPSCGI) $(LIBDIR)/`basename $(LIBCUPSCGI) .1`; \
145 fi
146 if test $(LIBCUPSCGI) = "libcupscgi.1.dylib"; then \
147 $(RM) $(LIBDIR)/libcupscgi.dylib; \
148 $(LN) $(LIBCUPSCGI) $(LIBDIR)/libcupscgi.dylib; \
149 fi
150 if test "x$(SYMROOT)" != "x"; then \
151 $(INSTALL_DIR) $(SYMROOT); \
152 cp $(LIBCUPSCGI) $(SYMROOT); \
153 dsymutil $(SYMROOT)/$(LIBCUPSCGI); \
154 fi
155
156 installstatic:
157 $(INSTALL_DIR) -m 755 $(LIBDIR)
158 $(INSTALL_LIB) -m 755 libcupscgi.a $(LIBDIR)
159 $(RANLIB) $(LIBDIR)/libcupscgi.a
160 $(CHMOD) 555 $(LIBDIR)/libcupscgi.a
161
162
163 #
164 # Uninstall all targets...
165 #
166
167 uninstall:
168 for file in $(CGIS); do \
169 $(RM) $(SERVERBIN)/cgi-bin/$$file; \
170 done
171 -$(RMDIR) $(SERVERBIN)/cgi-bin
172 $(RM) $(LIBDIR)/libcupscgi.1.dylib
173 $(RM) $(LIBDIR)/libcupscgi.a
174 $(RM) $(LIBDIR)/libcupscgi.dylib
175 $(RM) $(LIBDIR)/libcupscgi.so
176 $(RM) $(LIBDIR)/libcupscgi.so.1
177 -$(RMDIR) $(LIBDIR)
178 -if test "x$(privateinclude)" != x; then \
179 $(RM) $(PRIVATEINCLUDE)/cgi.h; \
180 $(RM) $(PRIVATEINCLUDE)/help-index.h; \
181 $(RMDIR) $(PRIVATEINCLUDE); \
182 fi
183
184
185 #
186 # libcupscgi.so.1
187 #
188
189 libcupscgi.so.1: $(LIBOBJS)
190 echo Linking $@...
191 $(DSO) $(ARCHFLAGS) $(DSOFLAGS) -o $@ $(LIBOBJS) $(LIBS)
192 $(RM) `basename $@ .1`
193 $(LN) $@ `basename $@ .1`
194
195
196 #
197 # libcupscgi.1.dylib
198 #
199
200 libcupscgi.1.dylib: $(LIBOBJS) libcupscgi.exp
201 echo Linking $@...
202 $(DSO) $(ARCHFLAGS) $(DSOFLAGS) -o $@ \
203 -install_name $(libdir)/$@ \
204 -current_version 1.0.0 \
205 -compatibility_version 1.0.0 \
206 -exported_symbols_list libcupscgi.exp \
207 $(LIBOBJS) $(LIBS)
208 $(RM) libcupscgi.dylib
209 $(LN) $@ libcupscgi.dylib
210
211
212 #
213 # libcupscgi.la
214 #
215
216 libcupscgi.la: $(LIBOBJS)
217 echo Linking $@...
218 $(LD_CC) $(ARCHFLAGS) $(DSOFLAGS) -o $@ $(LIBOBJS:.o=.lo) -rpath $(LIBDIR) \
219 -version-info 1:0 $(LIBS)
220
221
222 #
223 # libcupscgi.a
224 #
225
226 libcupscgi.a: $(LIBOBJS)
227 echo Archiving $@...
228 $(RM) $@
229 $(AR) $(ARFLAGS) $@ $(LIBOBJS)
230 $(RANLIB) $@
231
232
233 #
234 # admin.cgi
235 #
236
237 admin.cgi: admin.o ../Makedefs ../cups/$(LIBCUPS) $(LIBCUPSCGI)
238 echo Linking $@...
239 $(LD_CC) $(LDFLAGS) -o $@ admin.o -lcupscgi $(LIBS)
240
241
242 #
243 # classes.cgi
244 #
245
246 classes.cgi: classes.o ../Makedefs ../cups/$(LIBCUPS) $(LIBCUPSCGI)
247 echo Linking $@...
248 $(LD_CC) $(LDFLAGS) -o $@ classes.o -lcupscgi $(LIBS)
249
250
251 #
252 # help.cgi
253 #
254
255 help.cgi: help.o ../Makedefs ../cups/$(LIBCUPS) $(LIBCUPSCGI)
256 echo Linking $@...
257 $(LD_CC) $(LDFLAGS) -o $@ help.o -lcupscgi $(LIBS)
258
259
260 #
261 # jobs.cgi
262 #
263
264 jobs.cgi: jobs.o ../Makedefs ../cups/$(LIBCUPS) $(LIBCUPSCGI)
265 echo Linking $@...
266 $(LD_CC) $(LDFLAGS) -o $@ jobs.o -lcupscgi $(LIBS)
267
268
269 #
270 # makedocset
271 #
272
273 makedocset: makedocset.o ../Makedefs libcupscgi.a ../cups/$(LIBCUPSSTATIC)
274 echo Linking $@...
275 $(LD_CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ makedocset.o libcupscgi.a \
276 ../cups/$(LIBCUPSSTATIC) $(COMMONLIBS) $(SSLLIBS) $(DNSSDLIBS) \
277 $(LIBZ) $(LIBGSSAPI)
278
279
280 #
281 # printers.cgi
282 #
283
284 printers.cgi: printers.o ../Makedefs ../cups/$(LIBCUPS) $(LIBCUPSCGI)
285 echo Linking $@...
286 $(LD_CC) $(LDFLAGS) -o $@ printers.o -L. -lcupscgi $(LIBS)
287
288
289 #
290 # testcgi
291 #
292
293 testcgi: testcgi.o ../Makedefs libcupscgi.a ../cups/$(LIBCUPSSTATIC)
294 echo Linking $@...
295 $(LD_CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testcgi.o libcupscgi.a \
296 ../cups/$(LIBCUPSSTATIC) $(COMMONLIBS) $(SSLLIBS) $(DNSSDLIBS) \
297 $(LIBZ) $(LIBGSSAPI)
298 echo Testing CGI API...
299 ./testcgi
300
301
302 #
303 # testhi
304 #
305
306 testhi: testhi.o ../Makedefs libcupscgi.a ../cups/$(LIBCUPSSTATIC)
307 echo Linking $@...
308 $(LD_CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testhi.o libcupscgi.a \
309 ../cups/$(LIBCUPSSTATIC) $(COMMONLIBS) $(SSLLIBS) $(DNSSDLIBS) \
310 $(LIBZ) $(LIBGSSAPI)
311 echo Testing help index API...
312 ./testhi
313
314
315 #
316 # testtemplate
317 #
318
319 testtemplate: testtemplate.o ../Makedefs libcupscgi.a ../cups/$(LIBCUPSSTATIC)
320 echo Linking $@...
321 $(LD_CC) $(LDFLAGS) -o $@ testtemplate.o libcupscgi.a ../cups/$(LIBCUPSSTATIC) \
322 $(COMMONLIBS) $(SSLLIBS) $(DNSSDLIBS) $(LIBZ) $(LIBGSSAPI)
323
324
325 #
326 # Dependencies...
327 #
328
329 include Dependencies