File: Makefile

package info (click to toggle)
xpuzzles 7.6.3-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 14,208 kB
  • sloc: ansic: 94,274; makefile: 7,477; sh: 3,221
file content (340 lines) | stat: -rw-r--r-- 7,933 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
329
330
331
332
333
334
335
336
337
338
339
340
# @(#)Makefile
#
# Copyright 1995 - 2010  David A. Bagley, bagleyd@tux.org
#
# All Rights Reserved
#
# Permission to use, copy, modify, and distribute this software and
# its documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appear in all copies and
# that both that copyright notice and this permission notice appear in
# supporting documentation, and that the name of the author not be
# used in advertising or publicity pertaining to distribution of the
# software without specific, written prior permission.
#
# 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.

# Windows Makefile for Pyraminx

# DOS, UNIX & MKS
#CP = copy
#RM = del
#LN_S = cp

CP = cp -p
RM = rm -f
LN_S = ln -fs

# Set your C++ compiler
# Sun, SunC, Borland, Watcom, Microsoft, GNU
#CC = cc
#CC = acc
#CC = bcc
#CC = wcc
#CC = cl
#CC = CC
#CC = g++ -Wall -Woverloaded-virtual
#CC = gcc -Wall -ansi -pedantic
CC = gcc-3 -Wall -W -Wcast-qual -Wconversion -Wimplicit -Wmissing-declarations -Wunused -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wno-format -Wstrict-aliasing

# DEFAULT, Watcom
LD = $(CC)
#LD = wcl

# Microsoft, ?, Borland
#RC = rc
#RC = brc
#RC = brcc
RC = windres

# Sun, SunC
LINT = lint

INDENT = indent

# DOS, UNIX, PostScript
#PRINT = print
PRINT = lpr
#PRINT = enscript -2r

N=
C=.c
#C=.cpp
#C=.cc

O=.o
#O=.obj
S=$(N) $(N)
E=.exe
#E=
A=

# please define
# C as the C source code extension
# O as the object extension
# S as the separator for object code
# E as the executable extension

.SUFFIXES:	$(C) $(O) $(E) .rc .res

wIDGET = pyraminx
WIDGET = Pyraminx
P=w
R=$(P)
V=$(P)
PROG = $(R)$(wIDGET)
VER = $(V)$(wIDGET)
STORE = /dosa/$(PROG)/
STORE2 = /dosc/$(PROG)/

READPATH = c:/WINDOWS
#READPATH = /WINDOWS

#WINVER = 0x030a
WINVER = 0x0950

#DATAFILE = ./$(PROG).data
DATAFILE = $(PROG).ini
SCOREFILE = $(wIDGET).scores
LOGFILE = $(wIDGET).log

##CHOME = c:\\bc\\
#CHOME = c:\bc\
#CHOME = c:/bc/
#CHOME =
CHOME = /usr/lib/w32api
##INCPATH = $(CHOME)include
INCPATH = /usr/local/include
#LIBPATH = $(CHOME)lib
LIBPATH = $(CHOME)
INCLUDES = -I$(INCPATH)
LIBRARIES = -L$(LIBPATH) -lwinmm

HDRS = $(WIDGET)P.h $(WIDGET).h \
xwin.h file.h timer.h rngs.h sound.h version.h

COREOBJS = $(WIDGET)$(O)$(S)$(WIDGET)S$(O)$(S)$(WIDGET)U$(O)
OBJS = xwin$(O)$(S)file$(O)$(S)timer$(O)$(S)rngs$(O)$(S)sound$(O)$(S)\
$(COREOBJS)$(S)$(P)$(wIDGET)$(O)

CORESRCS = $(WIDGET)$(C) $(WIDGET)S$(C) $(WIDGET)U$(C)
SRCS = xwin$(C) file$(C) timer$(C) rngs$(C) sound$(C) \
$(CORESRCS) $(P)$(wIDGET)$(C)

TEXT = $(WIDGET).txt x$(wIDGET).htm

#OBJS = $(SRCS:$(C)=$(O))

DEFINES = -DWINVER=$(WINVER) -DHAVE_UNISTD_H \
-DSOUNDPATH=\"$(READPATH)\" -DSOUNDEXT=\".wav\" \
-DMOVESOUND=\"move\" \
-DDATAFILE=\"$(DATAFILE)\" \
-DSCOREFILE=\"$(SCOREFILE)\" -DLOGFILE=\"$(LOGFILE)\"

# large memory model: Borland, Microsoft, UNIX
##COPT = -ml -WE -v -w4
#COPT = -AL -GA -Ow -W4 -Zp -Zi
COPT = -O2 -mno-cygwin
#COPT = -g -DMONOTEST

# Borland, Microsoft, UNIX
#LOPT = -e
#LOPT = , /align:16, NUL, /nod llibcew libw oldnames,
#LOPT = -o
LOPT = -mwindows

CFLAGS = $(COPT) $(DEFINES) $(INCLUDES)
LDFLAGS = $(LOPT)
LIBS = $(LIBRARIES)

$(C)$(O):
	$(CC) -c $(CFLAGS) $<

.rc.res:
	$(RC) -r $(INCLUDES) $<

all:	$(PROG)$(E) $(TEXT)

$(WIDGET)P.h:	../$(WIDGET)P.h
	$(LN_S) ../$(WIDGET)P.h $(WIDGET)P.h

$(WIDGET).h:	../$(WIDGET).h
	$(LN_S) ../$(WIDGET).h $(WIDGET).h

xwin.h:	../xwin.h
	$(LN_S) ../xwin.h xwin.h

file.h:	../file.h
	$(LN_S) ../file.h file.h

timer.h:	../timer.h
	$(LN_S) ../timer.h timer.h

rngs.h:	../rngs.h
	$(LN_S) ../rngs.h rngs.h

sound.h:	../sound.h
	$(LN_S) ../sound.h sound.h

version.h:	../version.h
	$(LN_S) ../version.h version.h

$(WIDGET)$(C):	../$(WIDGET)$(C)
	$(LN_S) ../$(WIDGET)$(C) $(WIDGET)$(C)

$(WIDGET)S$(C):	../$(WIDGET)S$(C)
	$(LN_S) ../$(WIDGET)S$(C) $(WIDGET)S$(C)

$(WIDGET)U$(C):	../$(WIDGET)U$(C)
	$(LN_S) ../$(WIDGET)U$(C) $(WIDGET)U$(C)

xwin$(C):	../xwin$(C)
	$(LN_S) ../xwin$(C) xwin$(C)

file$(C):	../file$(C)
	$(LN_S) ../file$(C) file$(C)

timer$(C):	../timer$(C)
	$(LN_S) ../timer$(C) timer$(C)

rngs$(C):	../rngs$(C)
	$(LN_S) ../rngs$(C) rngs$(C)

sound$(C):	../sound$(C)
	$(LN_S) ../sound$(C) sound$(C)

$(PROG)$(C):	../x$(wIDGET)$(C)
	$(LN_S) ../x$(wIDGET)$(C) $(PROG)$(C)

$(WIDGET).txt:	../COPYING version.h ../README ../TODO ../ChangeLog ../NEWS
	cat ../COPYING > $(WIDGET).txt
	echo "" >> $(WIDGET).txt
	cat version.h | cut -f2 -d\" >> $(WIDGET).txt
	echo "" >> $(WIDGET).txt
	sed s/^x$(wIDGET)/w$(wIDGET)/ ../README >> $(WIDGET).txt
	echo "" >> $(WIDGET).txt
	cat ../TODO >> $(WIDGET).txt
	echo "" >> $(WIDGET).txt
	cat ../ChangeLog >> $(WIDGET).txt
	echo "" >> $(WIDGET).txt
	cat ../NEWS >> $(WIDGET).txt

# This is for X-Windows but contains some general stuff too.
x$(wIDGET).htm:	../x$(wIDGET).html
	$(LN_S) ../x$(wIDGET).html x$(wIDGET).htm

$(wIDGET).scores:	../$(wIDGET).scores
	$(CP) ../$(wIDGET).scores $(wIDGET).scores

$(WIDGET)$(O):	$(HDRS)
$(WIDGET)S$(O):	$(WIDGET).h $(WIDGET)P.h rngs.h
$(WIDGET)U$(O):	$(WIDGET).h $(WIDGET)P.h
xwin$(O):	xwin.h
file$(O):	file.h
timer$(O):	timer.h
rngs$(O):	rngs.h
sound$(O):	sound.h file.h
$(PROG)$(O):	$(WIDGET).h $(WIDGET)P.h xwin.h

$(wIDGET).ico:	../pixmaps/$(wIDGET).t.xpm ../pixmaps/$(wIDGET).m.xpm ../pixmaps/$(wIDGET).l.xpm
	xpmtoppm -alphaout $(wIDGET)_alpha.t.pgm ../pixmaps/$(wIDGET).t.xpm >\
		$(wIDGET).t.ppm
	xpmtoppm -alphaout $(wIDGET)_alpha.m.pgm ../pixmaps/$(wIDGET).m.xpm >\
		$(wIDGET).m.ppm
	xpmtoppm -alphaout $(wIDGET)_alpha.l.pgm ../pixmaps/$(wIDGET).l.xpm >\
		$(wIDGET).l.ppm
	ppmtowinicon -andpgms\
		$(wIDGET).t.ppm $(wIDGET)_alpha.t.pgm\
		$(wIDGET).m.ppm $(wIDGET)_alpha.m.pgm\
		$(wIDGET).l.ppm $(wIDGET)_alpha.l.pgm\
		> $(wIDGET).ico
	$(RM) *.ppm *.pgm

$(PROG).res:	$(PROG).rc $(WIDGET).h $(wIDGET).ico version.h
	$(RC) $< -O coff -o $@

#	$(RC) $(INCLUDES) $(PROG).rc

$(PROG)$(E):	$(OBJS) $(PROG).res $(wIDGET).scores
	$(LD) $(COPT) $(LDFLAGS) $(OBJS) $(PROG).res $(LIBS) -o $@

##$(PROG)$(E):	$(OBJS) $(PROG).res $(PROG).def
# Borland, Microsoft, UNIX
#	$(LD) $(COPT) $(OBJS) $(LIBS)
#	$(LD) $(COPT) $(OBJS) $(LIBS) $(LOPT)$(PROG)$(E)
#	$(LD) $(LOPT)$(PROG)$(E) $(COPT) $(OBJS) $(LIBS)
#	$(RC) $(INCLUDES) $(PROG).rc

run:	$(wIDGET).scores
	./$(PROG)

clean:
	$(RM) *.o *.exe* core *~ *% *.bak *.res *.obj *.lnk
	$(RM) *.sbr *.sbt *.pdb *.vcw *.wsp *.bsc

distclean:	clean
	$(RM) $(WIDGET)*$(C) $(WIDGET)*.h $(PROG)$(C) $(TEXT)
	$(RM) xwin$(C) file$(C) timer$(C) rngs$(C) sound$(C)
	$(RM) xwin.h file.h timer.h rngs.h sound.h version.h
	$(RM) $(wIDGET).scores

small:	all
	strip --strip-all $(PROG)$(E); true
	upx $(PROG)$(E); true

install:	small
	$(CP) $(PROG)$(E) `cygpath -W`
	$(CP) $(PROG).ini `cygpath -W`

uninstall:
	$(RM) `cygpath -W`/$(PROG)$(E)
	$(RM) `cygpath -W`/$(PROG).ini

lint :	$(SRCS)
	$(LINT) -ax -DLINT -DWINVER $(DEFS) $(INCLUDES) -I.. $(SRCS) $(LIBRARIES)

ASCIIWINEXTEND=c h ini rc txt htm scores
DOSDIR=../../win/$(PROG)
# Handles both versions (Linux and SunOS) of unix2dos and dos2unix

dos2unix:
	for j in ${ASCIIWINEXTEND}; do\
		for k in *.$${j}; do\
			if [ -r $${k} ]; then\
				cp $${k} $${k}.old;\
				dos2unix $${k}.old $${k};\
				rm $${k}.old;\
			fi;\
		done;\
	done

unix2dos:
	for j in ${ASCIIWINEXTEND}; do\
		for k in *.$${j}; do\
			if [ -r $${k} ]; then\
				cp $${k} $${k}.old;\
				unix2dos $${k}.old $${k};\
				rm $${k}.old;\
			fi;\
		done;\
	done

dist:
	mkdir -p $(DOSDIR);\
	for j in $(ASCIIWINEXTEND); do\
		for k in *.$${j}; do\
			if [ -r $${k} ]; then\
				cp $${k} $(DOSDIR)/$${k}.old;\
				cp $${k} $(DOSDIR)/$${k};\
				unix2dos $(DOSDIR)/$${k}.old $(DOSDIR)/$${k};\
				rm $(DOSDIR)/$${k}.old;\
			fi;\
		done;\
	done;\
	for k in *.exe *.ico *.bmp *.wav; do\
		if [ -r $${k} ]; then\
			cp -p $${k} $(DOSDIR)/$${k};\
		fi;\
	done