Add Makefile option to select whether or not to use a .pak file.

This commit is contained in:
Guus Sliepen 2011-08-27 21:29:08 +02:00
parent 44fa119ab7
commit 7768b4cc6d
2 changed files with 15 additions and 5 deletions

View File

@ -286,7 +286,6 @@ enum {
#define SHIP_HIT_INDEX 60 #define SHIP_HIT_INDEX 60
#define USEPACK 1
#ifndef PACKLOCATION #ifndef PACKLOCATION
#define PACKLOCATION "starfighter.pak" #define PACKLOCATION "starfighter.pak"
#endif #endif

View File

@ -8,15 +8,22 @@ PACK = starfighter.pak
DOCS = docs/* DOCS = docs/*
DATA = data/* gfx/* music/* sound/* DATA = data/* gfx/* music/* sound/*
USEPACK ?= 1
BINDIR = /usr/games/ BINDIR = /usr/games/
DATADIR = /usr/share/games/parallelrealities/ DATADIR = /usr/share/games/parallelrealities/
DOCDIR = /usr/share/doc/starfighter/ DOCDIR = /usr/share/doc/starfighter/
# top-level rule to create the program. # top-level rule to create the program.
all: $(PROG) ALL = $(PROG)
ifeq ($(USEPACK), 1)
ALL += $(PACK)
endif
all: $(ALL)
# compiling other source files. # compiling other source files.
%.o: code/%.cpp code/*.h %.o: code/%.cpp code/*.h
$(CXX) $(CFLAGS) -c -O3 -DVERSION=\"$(VERSION)\" -DPACKLOCATION=\"$(DATADIR)$(PACK)\" $< $(CXX) $(CFLAGS) -c -DVERSION=\"$(VERSION)\" -DPACKLOCATION=\"$(DATADIR)$(PACK)\" -DUSEPACK=$(USEPACK) $<
# linking the program. # linking the program.
$(PROG): $(OBJS) $(PROG): $(OBJS)
@ -24,17 +31,21 @@ $(PROG): $(OBJS)
# cleaning everything that can be automatically recreated with "make". # cleaning everything that can be automatically recreated with "make".
clean: clean:
$(RM) $(OBJS) $(RM) $(OBJS) $(ALL)
distclean: distclean:
$(RM) $(PROG) $(RM) $(PROG)
# install # install
install: install: $(ALL)
mkdir -p $(DATADIR) mkdir -p $(DATADIR)
strip $(PROG) strip $(PROG)
install -o root -g games -m 755 $(PROG) $(BINDIR)$(PROG) install -o root -g games -m 755 $(PROG) $(BINDIR)$(PROG)
ifeq ($(USEPACK), 1)
install -o root -g games -m 644 $(DATA) $(DATADIR)
else
install -o root -g games -m 644 $(PACK) $(DATADIR)$(PACK) install -o root -g games -m 644 $(PACK) $(DATADIR)$(PACK)
endif
cp $(DOCS) $(DOCDIR) cp $(DOCS) $(DOCDIR)
$(PACK): pack.py $(DATA) $(PACK): pack.py $(DATA)