New Makefile.raw system, works with MinGW/Windows environment and Linux also.

Uses a config.mk.tmpl file to set system dependend stuff, no bash required.

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@490 4a71c877-e1ca-e34f-864e-861f7616d084
master
Dennis Schridde 2006-07-21 21:48:55 +00:00
parent 07dcf43518
commit 3116f462fc
18 changed files with 380 additions and 443 deletions

View File

@ -1,5 +1,8 @@
SUBDIRS=lib src
all clean: $(SUBDIRS)
all clean dep:
@for i in $(SUBDIRS); do (cd $$i; $(MAKE) -f Makefile.raw $@); done
.PHONY: $(SUBDIRS)
$(SUBDIRS):
$(MAKE) -f Makefile.raw -C $@ $(MAKECMDGOALS)
src: lib

View File

@ -1,32 +1,25 @@
SUBDIRS=framework \
gamelib \
ivis_common \
ivis_opengl \
netplay \
script \
sequence \
sound \
widget
ifeq ($(GFX), software)
SUBDIRS+=ivis02
else
SUBDIRS+=ivis_opengl
endif
.PHONY: $(SUBDIRS)
all clean: $(SUBDIRS)
SUBDIRS_CLEAN= framework \
gamelib \
netplay \
script \
sequence \
sound \
widget \
ivis_common \
ivis02 \
ivis_opengl
all dep:
@for i in $(SUBDIRS); do (cd $$i; $(MAKE) -f Makefile.raw $@); done
clean:
@for i in $(SUBDIRS_CLEAN); do (cd $$i; $(MAKE) -f Makefile.raw $@); done
$(SUBDIRS):
$(MAKE) -f Makefile.raw -C $@ $(MAKECMDGOALS)
# Dependencies not needed, since no linking done?
#gamelib: framework ivis_common ivis_opengl sound
#ivis_common: framework gamelib
#ivis_opengl: framework ivis_common gamelib
#netplay: framework
#script: framework
#sequence: framework
#sound: framework gamelib
#widget: framework ivis_common

View File

@ -1,48 +1,25 @@
SRC_FILES= block.c \
configfile.c \
debug.c \
frame.c \
frameresource.c \
heap.c \
ignorecase.c \
input.c \
mem.c \
mono.c \
resource_parser.c \
resource_lexer.c \
strres.c \
strres_parser.c \
strres_lexer.c \
treap.c \
trig.c
MAKERULES=../../makerules
include $(MAKERULES)/configure.mk
#GENERATED_SRC= resource_l.c \
# resource_y.c \
# resource_y.h \
# strres_l.c \
# strres_y.c \
# strres_y.h
SRC=block.c \
configfile.c \
debug.c \
frame.c \
frameresource.c \
heap.c \
ignorecase.c \
input.c \
mem.c \
mono.c \
resource_parser.c \
resource_lexer.c \
strres.c \
strres_parser.c \
strres_lexer.c \
treap.c \
trig.c \
SDL_framerate.c
LIB=framework
MAKERULES=../../makerules
include $(MAKERULES)/lib.mk
resource_lexer.c: resource_lexer.l
flex $(<)
mv lex.res_.c $@
resource_parser.c resource_parser.h: resource_parser.y
bison -d -pres_ resource_parser.y
mv resource_parser.tab.c resource_parser.c
mv resource_parser.tab.h resource_parser.h
strres_lexer.c: strres_lexer.l
flex $(<)
mv lex.strres_.c $@
strres_parser.c strres_parser.h: strres_parser.y
bison -d -pstrres_ strres_parser.y
mv strres_parser.tab.c strres_parser.c
mv strres_parser.tab.h strres_parser.h

View File

@ -1,35 +1,15 @@
SRC_FILES= anim.c \
animobj.c \
audp_parser.c \
audp_lexer.c \
gtime.c \
hashtabl.c \
pqueue.c \
ptrlist.c
MAKERULES=../../makerules
include $(MAKERULES)/configure.mk
LIBS=framework ivis_common sound
ifeq ($(GFX), software)
LIBS+=ivis02
else
LIBS+=ivis_opengl
endif
GENERATED_SRC= audp_lexer.c \
audp_parser.c \
audp_parser.h
SRC=anim.c \
animobj.c \
audp_parser.c \
audp_lexer.c \
gtime.c \
hashtabl.c \
pqueue.c \
ptrlist.c
LIB=gamelib
MAKERULES=../../makerules
include $(MAKERULES)/lib.mk
audp_lexer.c: audp_lexer.l
flex $(<)
mv lex.audp_.c $@
audp_parser.c audp_parser.h: audp_parser.y
bison -d audp_parser.y
mv audp_parser.tab.c audp_parser.c
mv audp_parser.tab.h audp_parser.h

View File

@ -1,27 +1,25 @@
SRC_FILES= \
bspimd.c \
ivi.c \
pieblitfunc.c \
pieclip.c \
piedraw.c \
piefunc.c \
piematrix.c \
piemode.c \
piepalette.c \
piestate.c \
pietexture.c \
rendfunc.c \
rendmode.c \
screen.c \
tex.c \
textdraw.c \
v4101_stub.c \
vsr.c
MAKERULES=../../makerules
include $(MAKERULES)/configure.mk
LIBS=framework gamelib ivis_common
SRC=bspimd.c \
ivi.c \
pieblitfunc.c \
pieclip.c \
piedraw.c \
piefunc.c \
piematrix.c \
piemode.c \
piepalette.c \
piestate.c \
pietexture.c \
rendfunc.c \
rendmode.c \
screen.c \
tex.c \
textdraw.c \
v4101_stub.c \
vsr.c
LIB=ivis02
MAKERULES=../../makerules
include $(MAKERULES)/lib.mk

View File

@ -1,17 +1,15 @@
SRC_FILES= \
bitimage.c \
bug.c \
fbf.c \
imd.c \
imdload.c \
pcx.c \
pieclip.c \
piestate.c
MAKERULES=../../makerules
include $(MAKERULES)/configure.mk
LIBS=framework gamelib
SRC=bitimage.c \
bug.c \
fbf.c \
imd.c \
imdload.c \
pcx.c \
pieclip.c \
piestate.c
LIB=ivis_common
MAKERULES=../../makerules
include $(MAKERULES)/lib.mk

View File

@ -1,24 +1,22 @@
SRC_FILES= \
bspimd.c \
ivi.c \
pieblitfunc.c \
piedraw.c \
piefunc.c \
piematrix.c \
piemode.c \
piepalette.c \
piestate.c \
pietexture.c \
rendfunc.c \
rendmode.c \
screen.c \
tex.c \
textdraw.c
MAKERULES=../../makerules
include $(MAKERULES)/configure.mk
LIBS=ivis_common framework gamelib
SRC=bspimd.c \
ivi.c \
pieblitfunc.c \
piedraw.c \
piefunc.c \
piematrix.c \
piemode.c \
piepalette.c \
piestate.c \
pietexture.c \
rendfunc.c \
rendmode.c \
screen.c \
tex.c \
textdraw.c
LIB=ivis_opengl
MAKERULES=../../makerules
include $(MAKERULES)/lib.mk

View File

@ -1,15 +1,14 @@
SRC_FILES= netaudio_stub.c \
netcrypt.c \
netjoin_stub.c \
netlobby_stub.c \
netlog.c \
netplay.c \
netusers_stub.c
MAKERULES=../../makerules
include $(MAKERULES)/configure.mk
LIBS=framework
SRC=netaudio_stub.c \
netcrypt.c \
netjoin_stub.c \
netlobby_stub.c \
netlog.c \
netplay.c \
netusers_stub.c
LIB=netplay
MAKERULES=../../makerules
include $(MAKERULES)/lib.mk

View File

@ -1,25 +1,16 @@
SRC_FILES= codeprint.c \
event.c \
evntsave.c \
interp.c \
script.c \
script_parser.c \
script_lexer.c \
stack.c
MAKERULES=../../makerules
include $(MAKERULES)/configure.mk
LIBS=framework
SRC=codeprint.c \
event.c \
evntsave.c \
interp.c \
script.c \
script_parser.c \
script_lexer.c \
stack.c
LIB=script
MAKERULES=../../makerules
include $(MAKERULES)/lib.mk
script_lexer.c: script_lexer.l
flex $(<)
mv lex.scr_.c $@
script_parser.c script_y.h: script_parser.y
bison -d script_parser.y
mv script_parser.tab.c script_parser.c
mv script_parser.tab.h script_parser.h

View File

@ -1,12 +1,11 @@
SRC_FILES= adpcm.c \
dec130.c \
rpl_reader.c \
sequence_stub.c
MAKERULES=../../makerules
include $(MAKERULES)/configure.mk
LIBS=framework
SRC=adpcm.c \
dec130.c \
rpl_reader.c \
sequence_stub.c
LIB=sequence
MAKERULES=../../makerules
include $(MAKERULES)/lib.mk

View File

@ -1,20 +1,13 @@
SRC_FILES= audio.c \
cdaudio.c \
mixer_stub.c \
openal_track.c \
playlist.c \
track.c
MAKERULES=../../makerules
include $(MAKERULES)/configure.mk
LIBS=framework gamelib
ifeq ($(GFX), software)
LIBS+=ivis02
else
LIBS+=ivis_opengl
endif
SRC=audio.c \
cdaudio.c \
mixer_stub.c \
openal_track.c \
playlist.c \
track.c
LIB=sound
MAKERULES=../../makerules
include $(MAKERULES)/lib.mk

View File

@ -1,23 +1,16 @@
SRC_FILES= bar.c \
button.c \
editbox.c \
form.c \
label.c \
scrap.c \
slider.c \
tip.c \
widget.c
MAKERULES=../../makerules
include $(MAKERULES)/configure.mk
LIBS=framework ivis_common
ifeq ($(GFX), software)
LIBS+=ivis02
else
LIBS+=ivis_opengl
endif
SRC=bar.c \
button.c \
editbox.c \
form.c \
label.c \
scrap.c \
slider.c \
tip.c \
widget.c
LIB=widget
MAKERULES=../../makerules
include $(MAKERULES)/lib.mk

View File

@ -1,32 +1,8 @@
.SUFFIXES: .o
ifeq ($(EMUL), yes)
CFLAGS=-m32
LDFLAGS=-m32
SDLCONFIG=/emul/linux/x86/usr/bin/sdl-config
else
SDLCONFIG=sdl-config
endif
ifeq ($(OSTYPE), msys)
OPENGL_LIB=glu32 opengl32
OPENAL_LIB=openal32
else
OPENGL_LIB=GLU GL
OPENAL_LIB=openal
endif
#CC=gcc
CC=g++ -fpermissive
CFLAGS+=-gstabs -DYY_STATIC -DVERSION="2.0"
ifeq ($(MODE), prod)
CFLAGS+=-Wall -fno-strict-aliasing -O2
else
CFLAGS+=-Wall -g
endif
OBJ_FILES=$(SRC_FILES:%.c=%.o)
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $(<)
$(CC) $(CFLAGS) -c -o$@ $<
%.c: %.l
$(FLEX) $(FLEXFLAGS) -o$@ $<
%.c: %.y
$(BISON) -d $(BISONFLAGS) -o$@ $<

18
makerules/config.mk.tmpl Normal file
View File

@ -0,0 +1,18 @@
# Platform you are running
#PLATFORM=windows
#PLATFORM=linux
# Compiler you want to use
#COMPILER=gcc
#COMPILER=g++
# Compilation mode
#MODE=debug
#MODE=release
# Directory where you store your dev stuff (lib and include)
#DEVDIR=D:\Programme\Warzone-DevPkg
# Remind the user to install Flex and Bison
#BISON=bison
#FLEX=bison

77
makerules/configure.mk Normal file
View File

@ -0,0 +1,77 @@
include $(MAKERULES)/config.mk
# Check for unset config
ifeq ($(strip $(PLATFORM)),)
$(error You must set PLATFORM in $(MAKERULES)/config.mk)
else
$(info PLATFORM set to $(PLATFORM))
endif
ifeq ($(strip $(COMPILER)),)
$(error You must set COMPILER in $(MAKERULES)/config.mk)
else
$(info COMPILER set to $(COMPILER))
endif
ifeq ($(strip $(MODE)),)
$(error You must set MODE in $(MAKERULES)/config.mk)
else
$(info MODE set to $(MODE))
endif
ifeq ($(strip $(DEVDIR)),)
$(error You must set DEVDIR in $(MAKERULES)/config.mk)
else
$(info DEVDIR set to $(DEVDIR))
endif
ifeq ($(strip $(BISON)),)
$(error You must install Bison)
else
$(info Pretending that Bison is installed)
endif
ifeq ($(strip $(FLEX)),)
$(error You must install Flex)
else
$(info Pretending that Flex is installed)
endif
# Setup paths and static values
CFLAGS+=-m32 -DYY_STATIC -I.. -I../.. -I$(DEVDIR)/include
LDFLAGS+=-L$(DEVDIR)/lib
# Setup build environment with config values
ifeq ($(strip $(PLATFORM)),windows)
DIRSEP=\\
RMF=del /F
CFLAGS+=-DWIN32
LDFLAGS+=-lmingw32 -lglu32 -lopengl32 -lopenal32
else
DIRSEP=/
RMF=rm -f
CFLAGS+=-lGLU -lGL -lopenal
endif
ifeq ($(strip $(COMPILER)),g++)
CC=g++
CFLAGS+=-fpermissive
else
CC=gcc
endif
ifeq ($(strip $(MODE)),debug)
CFLAGS+=-Wall -O0 -g3 -DDEBUG
else
CFLAGS+=-march=i686 -O2
endif
LDFLAGS+=-lmad -lvorbisfile -lvorbis -logg -ljpeg6b -lpng13 -lphysfs -lzlib1 -lSDLmain -lSDL -lSDL_net
include $(MAKERULES)/common.mk

View File

@ -1,22 +1,6 @@
include $(MAKERULES)/common.mk
CFLAGS+=-I . `$(SDLCONFIG) --cflags` $(LIBS:%=-I ../lib/%)
LDFLAGS+=-L ../lib $(LIBS:%=-l%) $(EXT_LIBS:%=-l%)\
`$(SDLCONFIG) --libs`
all: $(EXE)
dep:
rm -f make.depend
touch make.depend
makedepend -fmake.depend -I . $(LIBS:%=-I ../lib/%) $(SRC_FILES) >& /dev/null
rm -f make.depend.bak
$(EXE): $(OBJ_FILES) $(LIBS:%=../lib/lib%.a)
$(CC) -o $@ $(OBJ_FILES) $(LDFLAGS)
clean:
rm -f $(EXE) *.o *~
-include make.depend
all: $(EXE).exe
$(EXE).exe: $(SRC:.c=.o) ; $(CC) $(CFLAGS) -o $(EXE).exe $(SRC:.c=.o) $(LIBS:%=../lib/lib%.a) $(LDFLAGS)
clean: ; $(RMF) $(EXE).exe *.o

View File

@ -1,24 +1,5 @@
LIB_FILE=$(LIB:%=../lib%.a)
include $(MAKERULES)/common.mk
CFLAGS+=`$(SDLCONFIG) --cflags` -I . $(LIBS:%=-I ../%) \
-I ../../src
all: $(LIB_FILE)
dep:
rm -f make.depend
touch make.depend
makedepend -fmake.depend -I . $(LIBS:%=-I ../%) -I ../../src $(SRC_FILES) >& /dev/null
rm -f make.depend.bak
$(LIB_FILE): $(OBJ_FILES)
rm -f $(LIB_FILE)
ar rcv $(LIB_FILE) $(OBJ_FILES)
clean:
rm -f $(LIB_FILE) *.o $(GENERATED_SRC) *~
-include make.depend
all: ../lib$(LIB).a
../lib$(LIB).a: $(SRC:.c=.o) ; ar rcv ../lib$(LIB).a $(SRC:.c=.o)
clean: ; $(RMF) ..$(DIRSEP)lib$(LIB).a *.o

View File

@ -1,155 +1,134 @@
SRC_FILES= ai.c \
astar.c \
action.c \
advvis.c \
atmos.c \
bridge.c \
buildpos.c \
cdspan.c \
cheat.c \
cluster.c \
cmddroid.c \
combat.c \
component.c \
console.c \
data.c \
design.c \
difficulty.c \
disp2d.c \
display.c \
droid.c \
e3demo.c \
edit2d.c \
edit3d.c \
effects.c \
environ.c \
fpath.c \
feature.c \
findpath.c \
formation.c \
frontend.c \
gateway.c \
gatewayroute.c \
gatewaysup.c \
geometry.c \
group.c \
hci.c \
init.c \
intdisplay.c \
intimage.c \
intorder.c \
intelmap.c \
keybind.c \
keymap.c \
level_lexer.c \
levels.c \
lighting.c \
loop.c \
map.c \
mapdisplay.c \
mapgrid.c \
mechanics.c \
message.c \
miscimd.c \
move.c \
multiint.c \
multimenu.c \
multiopt.c \
multisync.c \
multibot.c \
multistat.c \
objmem.c \
objects.c \
optimisepath.c \
order.c \
player.c \
powercrypt.c \
radar.c \
raycast.c \
research.c \
scores.c \
scriptai.c \
scriptcb.c \
scriptextern.c \
scriptfuncs.c \
scriptobj.c \
scripttabs.c \
scriptvals.c \
scriptvals_parser.c \
scriptvals_lexer.c \
selection.c \
stats.c \
text.c \
texture.c \
transporter.c \
visibility.c \
warcam.c \
water.c \
wrappers.c \
ani.c \
arrow.c \
aud.c \
audio_id.c \
bucket3d.c \
clparse.c \
configuration.c \
csnap.c \
display3d.c \
drive.c \
function.c \
game.c \
ingameop.c \
keyedit.c \
loadsave.c \
main.c \
mission.c \
mplayer_stub.c \
multigifts.c \
multijoin.c \
multilimit.c \
multiplay.c \
multistruct.c \
oprint.c \
power.c \
projectile.c \
seqdisp.c \
structure.c \
target.c \
warzoneconfig.c
EXE= warzone
LIBS= framework \
gamelib \
netplay \
script \
sequence \
sound \
widget
EXT_LIBS= mad vorbisfile vorbis ogg $(OPENAL_LIB) SDL_net jpeg png physfs z
ifeq ($(GFX), software)
LIBS+=ivis02
else
LIBS+=ivis_opengl
EXT_LIBS+=$(OPENGL_LIB)
endif
LIBS+=ivis_common
MAKERULES=../makerules
include $(MAKERULES)/configure.mk
SRC=ai.c \
astar.c \
action.c \
advvis.c \
atmos.c \
bridge.c \
buildpos.c \
cdspan.c \
cheat.c \
cluster.c \
cmddroid.c \
combat.c \
component.c \
console.c \
data.c \
design.c \
difficulty.c \
disp2d.c \
display.c \
droid.c \
e3demo.c \
edit2d.c \
edit3d.c \
effects.c \
environ.c \
fpath.c \
feature.c \
findpath.c \
formation.c \
frontend.c \
gateway.c \
gatewayroute.c \
gatewaysup.c \
geometry.c \
group.c \
hci.c \
init.c \
intdisplay.c \
intimage.c \
intorder.c \
intelmap.c \
keybind.c \
keymap.c \
level_lexer.c \
levels.c \
lighting.c \
loop.c \
map.c \
mapdisplay.c \
mapgrid.c \
mechanics.c \
message.c \
miscimd.c \
move.c \
multiint.c \
multimenu.c \
multiopt.c \
multisync.c \
multibot.c \
multistat.c \
objmem.c \
objects.c \
optimisepath.c \
order.c \
player.c \
powercrypt.c \
radar.c \
raycast.c \
research.c \
scores.c \
scriptai.c \
scriptcb.c \
scriptextern.c \
scriptfuncs.c \
scriptobj.c \
scripttabs.c \
scriptvals.c \
scriptvals_parser.c \
scriptvals_lexer.c \
selection.c \
stats.c \
text.c \
texture.c \
transporter.c \
visibility.c \
warcam.c \
wrappers.c \
ani.c \
arrow.c \
aud.c \
audio_id.c \
bucket3d.c \
clparse.c \
configuration.c \
csnap.c \
display3d.c \
drive.c \
function.c \
game.c \
ingameop.c \
keyedit.c \
loadsave.c \
main.c \
mission.c \
multigifts.c \
multijoin.c \
multilimit.c \
multiplay.c \
multistruct.c \
oprint.c \
power.c \
projectile.c \
seqdisp.c \
structure.c \
target.c \
version.c \
warzoneconfig.c
LIBS=framework \
gamelib \
ivis_common \
ivis_opengl \
netplay \
script \
sequence \
sound \
widget
EXE=warzone
include $(MAKERULES)/exe.mk
level_lexer.c: level_lexer.l
flex $(<)
mv lex.lev_.c $@
scriptvals_parser.c: scriptvals_parser.y
bison -d $(<)
mv scriptvals_parser.tab.c scriptvals_parser.c
mv scriptvals_parser.tab.h scriptvals_parser.h
scriptvals_lexer.c: scriptvals_lexer.l
flex $(<)
mv lex.scrv_.c $@