File: Makefile

package info (click to toggle)
c2esp 24-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 704 kB
  • sloc: ansic: 6,108; makefile: 219; sh: 46; python: 8
file content (328 lines) | stat: -rw-r--r-- 8,127 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
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
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
# makefile for c2esp

# Makefile for c2esp09 has -lcupsimage instead of /usr/lib/libcupsimage.so.2 (intention: to make sucessfully in non ubuntu distros)
# Makefile for c2esp13 has -lcups  (intention: to make sucessfully in Fedora)
# Makefile for c2esp19 has myopldecode compiled but no longer installed
# Makefile for c2esp20 has some redundant stuff deleted, ppd file names are echoed, c2espC added
# Makefile for c2esp21 has forceppd added

LANG=C
UNAME := $(shell uname)
MACH := $(shell uname -m | sed 's/i.86/x86_32/')

ifeq ($(UNAME),SunOS)
    EUID := $(shell /usr/xpg4/bin/id -u)
    SHELL=bash
    CC=gcc
    OLDGROFF=OLDGROFF
else
    EUID := $(shell id -u)
endif

SYSNAME := $(shell uname -n)

# Installation prefix...
PREFIX=/usr/local
PREFIX=/usr
PREFIX=$(DESTDIR)/usr

# Pathnames for this package...
BIN=$(PREFIX)/bin
FILTERBIN=$(PREFIX)/lib/cups/filter
MANDIR=$(PREFIX)/share/man
DOCDIR=$(PREFIX)/share/doc/c2esp/
PPDDIR=$(PREFIX)/share/ppd/c2esp/
INSTALL=install

# Programs and libraries
PROGS=
SCRIPTS= c2esplog
# put PROGS= myopldecode if you want to install this debug tool
#PROGS=		myopldecode
# DEVPROGS are compiled but not installed
DEVPROGS=	myopldecode
FILTERS=	c2esp c2espC command2esp
#SHELLS=
MANPAGES=
LIBJBG	=	-ljbig
LIBJBG85=	-ljbig
BINPROGS=

# User ID's
LPuid=-oroot
LPgid=-glp
ifeq ($(UNAME),Darwin)
    LPuid=-oroot
    LPgid=-gwheel
endif
ifeq ($(UNAME),FreeBSD)
    LPuid=-oroot
    LPgid=-gwheel
endif
ifeq ($(UNAME),OpenBSD)
    LPuid=-oroot
    LPgid=-gwheel
endif
ifeq ($(UNAME),SunOS)
    LPuid=-oroot
    LPgid=-glp
    INSTALL=/usr/ucb/install
endif
# If we aren't root, don't try to set ownership
ifneq ($(EUID),0)
    LPuid=
    LPgid=
endif

ifeq ($(UNAME),Linux)
#	BINPROGS += usb_printerid
endif

# Compiler flags
CFLAGS +=	-O2 -Wall
#CFLAGS +=	-m32 -O2 -Wall # to produce 32-bit binaries on 64-bit OS
#CFLAGS +=	-g #to make debug info


#
# The usual build rules
#

all:	all-test $(FILTERS) $(PROGS) $(DEVPROGS) $(BINPROGS) $(SHELLS) all-done

all-test:
	#
	# Compile Dependencies...
	#
#	@declare EXITCODE = 0;
	@if ! type $(CC) >/dev/null 2>&1; then \
	    echo "      ***"; \
	    echo "      *** Error: $(CC) is not installed!"; \
	    echo "      ***"; \
	    echo "      *** Install Software Development (gcc) package"; \
	    echo "      ***"; \
	    exit 1; \
	fi
	@if ! test -f /usr/include/stdio.h; then \
	    echo "      ***"; \
	    echo "      *** Error: /usr/include/stdio.h is not installed!"; \
	    echo "      ***"; \
	    echo "      *** Install Software Development (gcc) package"; \
	    echo "      *** for Ubuntu: sudo apt-get install build-essential"; \
	    echo "      ***"; \
	    exit 1; \
	fi
	@if ! test -f /usr/include/cups/raster.h; then \
	    echo "      ***"; \
	    echo "      *** Error: /usr/include/cups/raster.h is not installed!"; \
	    echo "      ***"; \
	    echo "      *** Install cups raster library package"; \
	    echo "      *** for Ubuntu: sudo apt-get install libcupsimage2-dev"; \
	    echo "      ***"; \
	    exit 1; \
	fi
	@if ! test -f /usr/include/cups/image.h; then \
	    echo "      ***"; \
	    echo "      *** Error: /usr/include/cups/image.h is not installed!"; \
	    echo "      ***"; \
	    echo "      *** Install cups raster library package"; \
	    echo "      *** for Ubuntu: sudo apt-get install libcupsimage2-dev"; \
	    echo "      ***"; \
	    exit 1; \
	fi
	@if ! test -f /usr/include/cups/sidechannel.h; then \
	    echo "      ***"; \
	    echo "      *** Error: /usr/include/cups/sidechannel.h is not installed!"; \
	    echo "      ***"; \
	    echo "      *** Install cups development package"; \
	    echo "      *** for Ubuntu: sudo apt-get install libcups2-dev"; \
	    echo "      ***"; \
	    exit 1; \
	fi
	@if ! test -f /usr/include/cups/driver.h; then \
	    echo "      ***"; \
	    echo "      *** Error: /usr/include/cups/driver.h is not installed!"; \
	    echo "      ***"; \
	    echo "      *** Install cups driver package"; \
	    echo "      *** for Ubuntu: sudo apt-get install libcupsdriver1-dev"; \
	    echo "      ***"; \
	    exit 1; \
	fi

	
	# ... OK!
	#

all-done:
	@echo
	@echo "It is possible that certain products which can be built using this"
	@echo "software module might form inventions protected by patent rights in"
	@echo "some countries (e.g., by patents about arithmetic coding algorithms"
	@echo "owned by IBM and AT&T in the USA). Provision of this software by the"
	@echo "author does NOT include any licences for any patents. In those"
	@echo "countries where a patent licence is required for certain applications"
	@echo "of this software module, you will have to obtain such a licence"
	@echo "yourself."
	@echo 

c2esp: c2esp.o c2espcommon.o $(LIBJBG85)
	$(CC) $(CFLAGS) -o $@ c2esp.o c2espcommon.o -lcupsimage -lcups -lcupsdriver $(LIBJBG85)

c2espC: c2espC.o c2espcommon.o 
	$(CC) $(CFLAGS) -o $@ c2espC.o c2espcommon.o -lcupsimage -lcups -lcupsdriver -lz

command2esp: command2esp.o c2espcommon.o
	$(CC) $(CFLAGS) -o $@ command2esp.o  c2espcommon.o -lcups -lcupsdriver

myopldecode: myopldecode.o $(LIBJBG)
	$(CC) $(CFLAGS) -o $@ $@.o $(LIBJBG) -lz

#
# Installation rules
#
install: all install-test install-prog install-ppd install-doc

	# Now use your printer configuration GUI to create a new printer.
	#
	# help forum.
	# http://sourceforge.net/projects/cupsdriverkodak/forums
	#

	@if [ "$(PROGS)" = "" ]; then \
		echo "the development tool myopldecode was not installed"; \
	fi
	@if [ "$(PROGS)" = "myopldecode" ]; then \
		echo "the development tool myopldecode was installed"; \
	fi

	#

install-test:
	#
	# Installation Dependencies...
	#
	# none as yet
	# ... OK!
	#
    

UDEVBIN=$(DESTDIR)/bin/

install-prog:
	#
	# Install driver, and development tools
	#

	if [ "$(PROGS)" != "" ]; then \
		$(INSTALL) -d $(BIN); \
		$(INSTALL) -c $(PROGS) $(BIN); \
	fi

	if [ "$(SCRIPTS)" != "" ]; then \
		$(INSTALL) -d $(BIN); \
		$(INSTALL) -c $(SCRIPTS) $(BIN); \
	fi
	$(INSTALL) -d $(FILTERBIN)
	$(INSTALL) -c $(FILTERS) $(SHELLS) $(FILTERBIN)/

	if [ "$(BINPROGS)" != "" ]; then \
	    $(INSTALL) -d $(UDEVBIN); \
	    $(INSTALL) -c $(BINPROGS) $(UDEVBIN); \
	fi

MODEL=$(DESTDIR)/usr/share/cups/model
#LOCALMODEL=$(DESTDIR)/usr/local/share/cups/model
PPD=$(DESTDIR)/usr/share/ppd
VARPPD=/var/lp/ppd
install-ppd:
	#
	# Install PPD files for CUPS
	#
	$(INSTALL) -d -m 755 $(PPDDIR)
	    cd ppd; \
	    for ppdfile in *.ppd; do echo $$ppdfile; \
	    $(INSTALL) -c -m 644 $$ppdfile $(PPDDIR); \
	    done;

forceppd:
	# attempt to assign new ppds to existing queues
	./c2esp.postinst configure

doc: README INSTALL 

install-doc: doc
	#
	# Install documentation
	#
	$(INSTALL) -d -m 755 $(DOCDIR)
	$(INSTALL) -c -m 644 COPYING $(DOCDIR)
	$(INSTALL) -c -m 644 INSTALL $(DOCDIR)
	$(INSTALL) -c -m 644 README $(DOCDIR)

# make README file from README.in just copy and make read only
README: README.in
	rm -f $@
	cp $@.in $@
	chmod -w $@

# make INSTALL file from INSTALL.in
# adds a contents section to the start, using the capitalised subject headings.
INSTALL: INSTALL.in Makefile
#INSTALL: INSTALL.in
	rm -f $@
	echo "TOPICS" > $@.tmp
	echo "------" >> $@.tmp
	grep ^[A-Z][A-Z] $@.in | sed "s/^/    * /" >> $@.tmp
	echo >> $@.tmp
	cat $@.tmp $@.in > $@
	rm -f $@.tmp
	chmod -w $@

#
# Uninstall
#
uninstall:
#	-rm -f $(MANDIR)/man1/arm2hpdl.1 $(MANDIR)/man1/usb_printerid.1
	-rm -rf $(PPDDIR)
	-rm -f $(BIN)/myopldecode
	-rm -f $(BIN)/c2esp
#	-rm -f $(BIN)/cupslog
	-rm -f $(BIN)/c2esplog
	-rm -f $(FILTERBIN)/c2esp
	-rm -f $(FILTERBIN)/c2espC
#	done
#remove any compessed ppds
	cd ppd; for ppdfile in *.ppd; do \
	    rm -f $(MODEL)/$$ppdfile.gz; \
	done;

#
# Clean
#
clean:
	-rm -f $(PROGS) $(BINPROGS) $(SHELLS) $(FILTERS) $(DEVPROGS)
	-rm -f *.o
	-rm -f *~
	-rm -f ppd/*~
	-rm -f *.tar.gz
#	-rm -f $(MANPAGES) manual.pdf

#
# Header dependencies
#
jbig.o: jbig.h
jbig85.o: jbig85.h
c2esp.o: jbig85.h c2espcommon.h
#c2espC.o: zlib.h 
myopldecode.o: jbig.h
command2esp.o: c2espcommon.h

#
#	PPD files
#
ppd: KodakESP_10.drv KodakESP_C_06.drv
	#
	# Generate PPD files using local tools
	#
	ppdc KodakESP_10.drv
	ppdc KodakESP_C_06.drv