Jamfile.next
author pasky
Fri, 26 Nov 2004 21:14:42 +0000
changeset 513 a6eaa0d97d8d
parent 452 14dfdf98b719
permissions -rw-r--r--
(svn r828) Everyone welcome table/sprites.h in trunk - so far not in use besides enum AnimCursors migrated from viewport.h and tiny fragment of enum Sprites migrated from ttd.h (we should slowly convert trunk to use the symbolic names instead of sprite numbers too to reduce the delta to map). Ported from the map branch, where the work was done by Darkvater, Celestar and Tron.
CFILES = 	ai.c aircraft_cmd.c aircraft_gui.c airport_gui.c
	bridge_gui.c clear_cmd.c command.c disaster_cmd.c
	dock_gui.c dummy_land.c economy.c engine.c engine_gui.c
	fileio.c gfx.c graph_gui.c industry_cmd.c industry_gui.c
	intro_gui.c landscape.c main_gui.c minilzo.c misc.c
	misc_cmd.c misc_gui.c music_gui.c namegen.c network.c
	news_gui.c oldloader.c order_cmd.c order_gui.c pathfind.c
	player_gui.c players.c rail_cmd.c rail_gui.c road_cmd.c
	road_gui.c roadveh_cmd.c roadveh_gui.c saveload.c sdl.c
	settings.c settings_gui.c ship_cmd.c ship_gui.c smallmap_gui.c
	sound.c spritecache.c station_cmd.c station_gui.c
	strings.c subsidy_gui.c texteff.c town_cmd.c town_gui.c
	train_cmd.c train_gui.c tree_cmd.c ttd.c
	tunnelbridge_cmd.c unmovable_cmd.c vehicle.c
	viewport.c water_cmd.c widget.c window.c screenshot.c
	airport.c newgrf.c terraform_gui.c sprite.c ;


LANGFILES = english.txt swedish.txt french.txt german.txt italian.txt slovak.txt hungarian.txt norwegian.txt danish.txt czech.txt galician.txt polish.txt romanian.txt;

####################
# On UNIX we use gcc
####################
if $(UNIX) {
	SDL_CONFIG_CFLAGS = `XX_SDL_CONFIG_PLACEHOLDER_XX --cflags` ;
	SDL_CONFIG_LIBS = `XX_SDL_CONFIG_PLACEHOLDER_XX --libs` ;

	LINKFLAGS += $(SDL_CONFIG_LIBS) ;
	CC = gcc ;
	CCFLAGS += -Wall -Wno-multichar -DUNIX -DWITH_SDL ;

	OPTIMFLAGS = -O2 -fomit-frame-pointer ;
	DEBUGFLAGS = -g ;

# also include extmidi
	CFILES += extmidi.c unix.c ;

# compile in PNG support?
	if $(WITH_PNG) {
		CCFLAGS += -DWITH_PNG -I$(WITH_PNG) ;
		LINKFLAGS += -lpng ;
	}

# compile in zlib support?
	if $(WITH_ZLIB) {
		CCFLAGS += -DWITH_ZLIB ;
		LINKFLAGS += -lz ;
	}
# compile for BeOS 5.1 and higher
	if $(WITH_BONE_NETWORKING) {
		CCFLAGS += -DENABLE_NETWORK ;
		LINKFLAGS += -lsocket -lbind ;
	}
# link in BeOS MIDI and Be API libraries
	if $(BEOS_MIDI) {
		CCFLAGS += -DBEOS_MIDI ;
		LINKFLAGS += -lbe -lmidi ;
		CFILES += bemidi.cpp ;
	}
}

####################
# MSVC on Win32
####################

actions ActWin32Res {
	$(VISUALC)\\..\\common\\msdev98\\bin\\rc /r /i $(STDHDRS) /fo $(<) $(>)
}

rule Win32Res { ActWin32Res $(<) : $(>) ; DEPENDS $(<) : $(>) ; }

if $(TOOLSET) = VISUALC {
	OPTIMFLAGS = /Oa /Os /Ow /Oy /Oi /Og /Ox /Gr /Gf /Gy /Zp4 /J	/WX /W3 -DNDEBUG ;

	CCFLAGS += -DWIN32 -DWIN32_EXCEPTION_TRACKER ;
	CFILES += win32.c ;
	LINKFLAGS += /opt:nowin98 /LIBPATH:$(VISUALC)\\lib ;

	LINKLIBS = ws2_32.lib winmm.lib user32.lib gdi32.lib ;

# compile resources too
	EOBJ = ttd.res ;
	Win32Res ttd.res : ttd.rc ;

# png screenshots?
	if $(WITH_PNG) {
		CCFLAGS += -DWITH_PNG -I$(WITH_PNG) ;
		LINKLIBS += libpng.lib ;
	}

# zlib savegames?
	if $(WITH_ZLIB) {
		CCFLAGS += -DWITH_ZLIB ;
		LINKLIBS += zlibstat.lib ;
	}

# build release by default
	RELEASE = 1 ;
}


####################
# Common
####################
rule MyObjects {
	local _i _t _s ;

	_t = $(OUTDIR)/$(>:S=$(SUFOBJ)) ;
	OPTIM on $(_t) = $(3) ;

	MkDir $(OUTDIR) ;
	Depends $(_t) : $(OUTDIR) ;

	for _i in $(>) {
		_s = $(OUTDIR)/$(_i:S=$(SUFOBJ)) ;
		Object $(_s) : $(_i) ;

# special handling for sdl.c and unix.c
		if $(_i) = sdl.c || $(_i) = unix.c { CCFLAGS on $(_s) += $(SDL_CONFIG_CFLAGS) ; }
	}
	MainFromObjects $(OUTDIR)/$(<) : $(_t) $(EOBJ) ;
}

rule MyMain {
	if $(RELEASE) {
		OUTDIR = release ;
		MyObjects ttd : $(>) : $(OPTIMFLAGS) ;
	} else {
		OUTDIR = debug ;
		MyObjects ttd : $(>) : -D_DEBUG $(DEBUGFLAGS) ;
	}
}

actions CompileLang {
	strgen$(SLASH)strgen $(>)
}

rule LangFile {
	if $(>) = lang/english.txt {
		CompileLang $(<) table/strings.h : ;
		DEPENDS table/string.h : $(>) ;
	} else {
		CompileLang $(<) : $(>) ;
	}

	Clean clean : $(<) ;
	DEPENDS $(<) : $(>) ;
	DEPENDS all : $(<) ;
	DEPENDS $(<) : strgen/strgen ;
}

rule LangFiles {
	local _i ;
	for _i in $(<) { LangFile $(_i:S=.lng) : $(_i) ; }
	Clean clean : table/strings.h ;
}

LangFiles lang/$(LANGFILES) ;

Main strgen/strgen : strgen/strgen.c ;

MyMain ttd : $(CFILES) ;