1#
2# @(#) Makefile for XTrojka
3#
4
5#############################################################################
6#
7#	GENERAL
8#
9PROGS= xtrojka
10#					xtrojka version (do not change!)
11VERSION=123
12#					where to put the binary
13TARGET_DIR=${PREFIX}/bin
14#					where to put the manpage
15MANDIR=${PREFIX}/man/man6
16#					the location of the highscorefile
17HSFILE=${PREFIX}/share/xtrojka/xtrojka.scores
18#					your favourite packer
19COMPRESS=gzip -v9
20#					your favourite c-compiler
21CC?=gcc
22#					used X libraries
23XLIBS= -lXaw -lXmu -lXt -lX11 -lXext
24#					some more X libraries
25RESGEN=./resgen
26
27##############################################################################
28#
29#	FILE SETS
30#
31
32SRCS=	xtrojka.c tr_core.c game.c menu_tool.c window.c pics.c screen.c \
33	sh_main.c sh_slist.c sh_stat.c \
34	menu.c scores.c slist.c preferences.c options.c actions.c
35
36OBJS=$(SRCS:.c=.o)
37
38OTHER=Makefile XTrojka.* *.h bitmaps pixmaps AUTHOR COPYRIGHT MANIFEST README \
39	resgen xtrojka.man YIKES xtrojka$(VERSION).lsm
40
41###########################################################################
42#
43#	SYSTEM OPTIONS
44#
45
46HSF=-DSCOREFILE='"$(HSFILE)"'
47#
48#	comment out your favorite system (the one you use, that is...)
49#
50#					search the libaries here
51LIBPATH=-L${LOCALBASE}/lib
52#					doesn't work too well on all systems
53#LCK=-DLOCKING
54#					add debug info
55#DBG=-DDEBUG_INFO
56#					use slick graphics (multi-color-xpm)
57XPM=-DXPM
58XPMLIB=-lXpm
59
60#	Comment out the options for the system you use
61
62#
63# Sunos 4.1.3
64#
65#XDIR=-I/usr/openwin/include
66#LIBS=-lm
67#SYS=-DSUNOS4
68#
69# Solaris
70#
71#XDIR=-I/usr/openwin/include
72#LIBS=-lnsl
73#SYS=-DSUNOS5
74
75#
76# Linux
77#
78#SYS=-DLINUX
79
80#
81# FreeBSD
82#
83XDIR=-I${LOCALBASE}/include
84LIBS=-lm
85
86#
87#
88#
89CFLAGS= $(XDIR) $(DBG) $(XPM) $(SYS) $(OPT) $(HSF) $(LCK) $(LIBPATH)
90
91###########################################################################
92#
93#	COMMANDS
94#
95
96all: 	$(PROGS)
97
98xtrojka: $(OBJS)
99	$(CC) $(CFLAGS) $(OBJS) $(LIBS) $(XPMLIB) $(XLIBS) -o xtrojka
100
101tag:
102	ctags $(SRCS)
103
104tar:
105	rm -rf xtrojka$(VERSION);	\
106	mkdir xtrojka$(VERSION);	\
107	cp -r $(SRCS) $(OTHER) xtrojka$(VERSION);	\
108	rm -f xtrojka$(VERSION)/_*.h;		\
109	tar cvf xtrojka$(VERSION).tar xtrojka$(VERSION);	\
110	$(COMPRESS) xtrojka$(VERSION).tar;	\
111	rm -rf xtrojka$(VERSION);
112
113install:
114	@rm -f hsn
115	echo $(HSFILE)|sed -e 's/\//\\\//g'>hsn
116	sed -e "s/__SCOREDIR__/`cat hsn`/g" xtrojka.man > xtrojka.6
117	gzip -c xtrojka.6 >$(MANDIR)/xtrojka.6.gz
118	$(BSD_INSTALL_PROGRAM) xtrojka $(TARGET_DIR)
119	touch $(HSFILE)
120	chmod 664 $(HSFILE)
121	@rm -f hsn
122
123clean:
124	rm -rf tags *.o core xtrojka xtrojka.6
125
126##############################################################################
127#
128#	DEPENDENCIES
129#
130
131_strdefs.h _resdefs.h:	XTrojka.uk
132	$(RESGEN)
133
134actions.o: actions.c actions.h xtrojka.h debug.h
135game.o: game.c game.h xtrojka.h sh_main.h sh_stat.h scores.h menu.h menu_tool.h \
136  debug.h tr_core.h screen.h
137menu.o: menu.c debug.h xtrojka.h tr_core.h menu.h menu_tool.h game.h sh_main.h
138menu_tool.o: menu_tool.c xtrojka.h tr_core.h menu_tool.h menu.h debug.h
139options.o: options.c xtrojka.h debug.h
140pics.o: pics.c xtrojka.h tr_core.h pics.h window.h debug.h pictures.h \
141  bitmaps/block0 bitmaps/block1 bitmaps/block2 bitmaps/block3 bitmaps/block4 \
142  bitmaps/block5 bitmaps/pat1 bitmaps/pat2 bitmaps/pat3 bitmaps/pat4 \
143  bitmaps/pat5 bitmaps/leftpillar bitmaps/rightpillar bitmaps/new \
144  bitmaps/title bitmaps/app_icon bitmaps/stat_icon pixmaps/block1 \
145  pixmaps/block2 pixmaps/block3 pixmaps/block4 pixmaps/block5 \
146  pixmaps/leftpillar pixmaps/rightpillar
147preferences.o: preferences.c debug.h xtrojka.h tr_core.h preferences.h
148scores.o: scores.c debug.h xtrojka.h tr_core.h scores.h slist.h sh_slist.h \
149  _strdefs.h
150screen.o: screen.c screen.h debug.h xtrojka.h tr_core.h
151sh_main.o: sh_main.c debug.h xtrojka.h tr_core.h screen.h sh_slist.h sh_main.h \
152  window.h pictures.h bitmaps/block0 bitmaps/block1 bitmaps/block2 \
153  bitmaps/block3 bitmaps/block4 bitmaps/block5 bitmaps/pat1 bitmaps/pat2 \
154  bitmaps/pat3 bitmaps/pat4 bitmaps/pat5 bitmaps/leftpillar \
155  bitmaps/rightpillar bitmaps/new bitmaps/title bitmaps/app_icon \
156  bitmaps/stat_icon pixmaps/block1 pixmaps/block2 pixmaps/block3 \
157  pixmaps/block4 pixmaps/block5 pixmaps/leftpillar pixmaps/rightpillar menu.h \
158  menu_tool.h
159sh_slist.o: sh_slist.c sh_slist.h xtrojka.h screen.h window.h font.h scores.h \
160  pictures.h bitmaps/block0 bitmaps/block1 bitmaps/block2 bitmaps/block3 \
161  bitmaps/block4 bitmaps/block5 bitmaps/pat1 bitmaps/pat2 bitmaps/pat3 \
162  bitmaps/pat4 bitmaps/pat5 bitmaps/leftpillar bitmaps/rightpillar bitmaps/new \
163  bitmaps/title bitmaps/app_icon bitmaps/stat_icon pixmaps/block1 \
164  pixmaps/block2 pixmaps/block3 pixmaps/block4 pixmaps/block5 \
165  pixmaps/leftpillar pixmaps/rightpillar slist.h debug.h tr_core.h _strdefs.h
166sh_stat.o: sh_stat.c sh_stat.h debug.h xtrojka.h tr_core.h screen.h window.h \
167  pictures.h bitmaps/block0 bitmaps/block1 bitmaps/block2 bitmaps/block3 \
168  bitmaps/block4 bitmaps/block5 bitmaps/pat1 bitmaps/pat2 bitmaps/pat3 \
169  bitmaps/pat4 bitmaps/pat5 bitmaps/leftpillar bitmaps/rightpillar bitmaps/new \
170  bitmaps/title bitmaps/app_icon bitmaps/stat_icon pixmaps/block1 \
171  pixmaps/block2 pixmaps/block3 pixmaps/block4 pixmaps/block5 \
172  pixmaps/leftpillar pixmaps/rightpillar _strdefs.h
173slist.o: slist.c debug.h xtrojka.h slist.h scores.h sh_slist.h
174tr_core.o: tr_core.c tr_core.h
175window.o: window.c window.h tr_core.h sh_slist.h sh_stat.h debug.h xtrojka.h
176xtrojka.o: xtrojka.c xtrojka.h scores.h options.h preferences.h sh_slist.h \
177  sh_stat.h game.h menu_tool.h menu.h window.h pics.h slist.h actions.h debug.h \
178  tr_core.h _strdefs.h _resdefs.h
179
180