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 341 342 343 344 345 346 347 348
|
# @config_args@
# Written by Peter Ekberg, peda@lysator.liu.se
SHELL = /bin/sh
CC = @CC@
DD = dd
INSTALL = @INSTALL@
NO_PBM = @no_pbm@
NO_SVGA = @no_svga@
NO_X = @no_x@
SOUND = @sound@
POD2MAN = @pod2man@
prefix = @prefix@
exec_prefix = @exec_prefix@
BINDIR = @bindir@
MANDIR = @mandir@
STATEDIR = @sharedstatedir@
DEFINES = $(strip \
-DHIGHSCOREFILE=\"$(FULLHISCORE)\" \
-DVERSION=\"$(VERSION)\" \
@DEFS@)
OPTIMIZE = @optimize@
COMPILE = @cflags@
ALL_CFLAGS = $(strip \
$(DEFINES) $(OPTIMIZE) $(COMPILE) \
@X_CFLAGS@ @SVGA_CFLAGS@)
SVGA_LIBS = @SVGA_LIBS@ -lvgagl -lvga
X_LIBS = @X_PRE_LIBS@ @X_LIBS@ @X_EXTRA_LIBS@ -lXext -lX11
LDFLAGS = @LDFLAGS@
PBM_FLAGS = @PBM_CFLAGS@ @PBM_LIBS@ -lppm -lpgm -lpbm -DVERSION=\"0.6\"
MAN = thrust.man
HIGHSCORE = thrust.highscore
FULLHISCORE = $(STATEDIR)/$(HIGHSCORE)
VERSION_NR = @version_nr@
VERSION = @version@
LIBS = -lm
HELPPRG = $(addprefix helpers/, bin2c txt2c ppm2c reverse)
BIN8 = $(addprefix datasrc/, \
blks0.bin blks1.bin blks2.bin blks3.bin \
blks4.bin blks5.bin blks6.bin blks7.bin \
blks8.bin blks9.bin blksa.bin blksb.bin \
blksc.bin blksd.bin blkse.bin blksf.bin )
SOURCEOBJS = $(addprefix src/, \
thrust.o fast_gr.o hiscore.o conf.o things.o init.o \
level.o font5x5.o graphics.o @LIBOBJS@)
DATAOBJS = $(addprefix datasrc/, \
font.o blks.o ship.o shld.o colors.o bullet.o title.o \
level1.o level2.o level3.o level4.o level5.o level6.o \
demomove.o)
SOUNDITOBJS = $(addprefix src/, soundIt.o)
SOUNDOBJS = $(addprefix datasrc/, \
boom.o boom2.o harp.o thrust.o zero.o)
ifeq ($(SOUND),yes)
OBJS = $(SOURCEOBJS) $(DATAOBJS) $(SOUNDITOBJS) $(SOUNDOBJS)
else
OBJS = $(SOURCEOBJS) $(DATAOBJS)
endif
X_OBJS = $(addprefix src/, X11key.o X11.o) \
$(addprefix datasrc/, icon48.o)
SVGA_OBJS = $(addprefix src/, svgakey.o ksyms.o svga.o)
TARFILE = thrust-$(VERSION).src.tar
BINTARFILE = thrust-$(VERSION).bin.tar
DISTFILES = COPYING README INSTALL TODO CHANGES thrustrc thrust.lsm \
thrust-$(VERSION).lsm $(MAN) $(HIGHSCORE)
SRCDISTFILES = $(addsuffix .pod.in, $(basename $(MAN))) Makefile*.in \
configure.in configure install-sh config.sub config.guess
BINDISTFILES = Makefile.bindist
#######################
#
# Targets.
#
#######################
.PHONY: all install uninstall install-man uninstall-man \
clean distclean mostlyclean realclean \
dep TAGS info dvi man dist bindist zip
ifeq ($(NO_X),yes)
ifeq ($(NO_SVGA),yes)
all:
@echo Unable to find any one of X and Svgalib.
@echo Try reconfiguring.
install:
else
all: thrust
install: thrust
endif
else
ifeq ($(NO_SVGA),yes)
all: xthrust
install: xthrust
else
all: thrust xthrust
install: thrust xthrust
endif
endif
@if test ! -d $(DEB)/$(BINDIR) ; then \
echo $(INSTALL) -d $(DEB)/$(BINDIR); \
$(INSTALL) -d $(DEB)/$(BINDIR); \
fi
ifneq ($(NO_SVGA),yes)
$(INSTALL) thrust $(DEB)/$(BINDIR)/thrust
endif
ifneq ($(NO_X),yes)
$(INSTALL) xthrust $(DEB)/$(BINDIR)/xthrust
endif
# @if test ! -d $(DEB)/$(STATEDIR) ; then \
# echo $(INSTALL) -d $(DEB)/$(STATEDIR); \
# $(INSTALL) -d $(DEB)/$(STATEDIR); \
# fi
# @if test ! -f $(DEB)/$(FULLHISCORE) ; then \
# echo $(INSTALL) -m 660 $(HIGHSCORE) $(DEB)/$(FULLHISCORE);\
# $(INSTALL) -m 660 $(HIGHSCORE) $(DEB)/$(FULLHISCORE); \
# fi
uninstall:
rm -i $(BINDIR)/thrust
rm -i $(BINDIR)/xthrust
rm -i $(FULLHISCORE)
install-man: man
$(INSTALL) -m 0644 $(MAN) $(DEB)/$(MANDIR)/man6/$(addsuffix .6,$(basename $(MAN)))
uninstall-man:
rm $(MANDIR)/man6/$(addsuffix .6,$(basename $(MAN)))
clean:
rm -rf $(strip *~ core thrust xthrust $(OBJS) $(X_OBJS) $(SVGA_OBJS) \
$(HELPPRG) datasrc/blks*.bin .depend )
distclean: clean
rm -f src/TAGS $(TARFILE).gz \
Makefile Makefile.bindist \
$(addsuffix .pod, $(basename $(MAN))) src/config.h
mostlyclean:
rm -rf *~ core thrust xthrust $(SOURCEOBJS) $(X_OBJS) $(SVGA_OBJS)
realclean: distclean
rm -f $(MAN) datasrc/title.c datasrc/icon48.c $(BINTARFILE).gz \
config.cache config.log config.status configure \
thrust-$(VERSION).lsm
dep:
$(CC) -M $(patsubst %.o,%.c,$(SOURCEOBJS)) > .depend
ifneq ($(NO_SVGA),yes)
$(CC) -M $(patsubst %.o,%.c,$(SVGA_OBJS)) >> .depend
endif
ifneq ($(NO_X),yes)
$(CC) -M $(patsubst %.o,%.c,$(X_OBJS)) >> .depend
endif
TAGS:
etags src/*.c -o src/TAGS
info:
@echo No documentation available.
dvi:
@echo No documentation available.
man: $(MAN)
dist: man $(patsubst %.o,%.c,$(DATAOBJS))
mkdir thrust-$(VERSION)
mkdir thrust-$(VERSION)/src
mkdir thrust-$(VERSION)/datasrc
mkdir thrust-$(VERSION)/helpers
mkdir thrust-$(VERSION)/DirectX
cp -dpf $(DISTFILES) thrust-$(VERSION)
cp -dpf $(SRCDISTFILES) thrust-$(VERSION)
cp -dpf src/*.h src/*.c src/*.in \
thrust-$(VERSION)/src
cp -dpf datasrc/*.c datasrc/*.bmp datasrc/*.snd \
datasrc/*.pal datasrc/*.def datasrc/*.ppm \
datasrc/demomove.bin \
thrust-$(VERSION)/datasrc
cp -dpf helpers/*.c thrust-$(VERSION)/helpers
cp -dpf DirectX/* thrust-$(VERSION)/DirectX
rm -f thrust-$(VERSION)/src/config.h
chmod -R g-w thrust-$(VERSION)/*
tar -cf $(TARFILE) thrust-$(VERSION)/*
gzip -f9 $(TARFILE)
rm -rf thrust-$(VERSION)
ifneq ($(NO_SVGA),yes)
ifneq ($(NO_X),yes)
bindist: thrust xthrust man
mkdir thrust-$(VERSION)
cp -dpf $(DISTFILES) $(BINDISTFILES) xthrust thrust thrust-$(VERSION)
mv thrust-$(VERSION)/Makefile.bindist thrust-$(VERSION)/Makefile
chmod -R g-w thrust-$(VERSION)/*
tar -cf $(BINTARFILE) thrust-$(VERSION)/*
gzip -f9 $(BINTARFILE)
rm -rf thrust-$(VERSION)
else
bindist:
@echo Only for Linux with both X and SVGAlib.
endif
else
bindist:
@echo Only for Linux with both X and SVGAlib.
endif
#######################
#
# Implicit rules.
#
#######################
# Compile C files to object files.
%.o: %.c
$(CC) $(ALL_CFLAGS) -c -o $(addprefix $(dir $<), $(notdir $@)) $<
# Extract palette information.
%.bin: %.pal
$(DD) of=$@ if=$< bs=1 skip=790
# Extract picture information.
%.rev: %.bmp
$(DD) of=$@ if=$< bs=1 skip=1078
# The bmp format stores rows backwards (last row first).
# These rules are used to "reverse" the order in which the rows are stored.
# There is one rule for each of the three used widths of the line.
%.bin: %-4.rev
$(MAKE) helpers/reverse
helpers/reverse 4 < $< > $@
%.bin: %-8.rev
$(MAKE) helpers/reverse
helpers/reverse 8 < $< > $@
%.bin: %-16.rev
$(MAKE) helpers/reverse
helpers/reverse 16 < $< > $@
# Make a C file out of a text file. The info is stored in an array of strings.
# One line in the original text file will be stored in one cell of the array.
%.c: %.def
$(MAKE) helpers/txt2c
helpers/txt2c $(notdir $(basename $<)) < $< > $@
# Make a C file out of a binary file. The info is stored in a byte array.
%.c: %.bin
$(MAKE) helpers/bin2c
helpers/bin2c bin_$(notdir $(basename $<)) < $< > $@
# Make a C file out of a sound file.
%.c: %.snd
$(MAKE) helpers/bin2c
/bin/echo > $@
/bin/echo unsigned int sound_$(notdir $(basename $<))_len = \
`wc -c < $<`\; >> $@
helpers/bin2c sound_$(notdir $(basename $<)) < $< >> $@
# Make a C file out of a ppm picture file.
%.c: %.ppm
ifeq ($(NO_PBM),yes)
@echo Must configure with pbm to build ppm2c.
@echo Warning: Unable to rebuild $@ from $<.
else
$(MAKE) helpers/ppm2c
helpers/ppm2c -n $(notdir $(basename $<)) -m 32 < $< > $@
endif
# Make a man page from a pod source
%.man: %.pod
ifeq ($(POD2MAN),)
@echo Must have pod2man to rebuild man page.
@echo Warning: Unable to rebuild $@ from $<.
else
$(POD2MAN) $< > $@
endif
# Make html man page from a pod source
%.html: %.pod
ifeq ($(POD2MAN),)
@echo Must have pod2html to rebuild man page.
@echo Warning: Unable to rebuild $@ from $<.
else
$(subst pod2man,pod2html,$(POD2MAN)) $<
mv thrust.html thrust.tmp
grep -x -v . thrust.tmp > thrust.html
rm -f thrust.tmp
endif
#######################
#
# Secondary targets.
#
#######################
ifneq ($(NO_SVGA),yes)
thrust: $(OBJS) $(SVGA_OBJS)
$(CC) $(LDFLAGS) -o thrust $(OBJS) $(SVGA_OBJS) $(SVGA_LIBS) $(LIBS)
endif
ifneq ($(NO_X),yes)
xthrust: $(OBJS) $(X_OBJS)
$(CC) $(LDFLAGS) -o xthrust $(OBJS) $(X_OBJS) $(X_LIBS) $(LIBS)
endif
datasrc/blks.bin: $(BIN8)
cat $^ > $@
helpers/reverse: helpers/reverse.c
$(CC) @DEFS@ $(COMPILE) $< -o $@
helpers/bin2c: helpers/bin2c.c
$(CC) @DEFS@ $(COMPILE) $< -o $@
helpers/txt2c: helpers/txt2c.c
$(CC) @DEFS@ $(COMPILE) $< -o $@
ifneq ($(NO_PBM),yes)
helpers/ppm2c: helpers/ppm2c.c $(addprefix src/, @LIBOBJS@)
$(CC) @DEFS@ $< $(PBM_FLAGS) -o $@
endif
#######################
#
# Dependencies.
#
#######################
ifeq (.depend,$(wildcard .depend))
include .depend
endif
|