## BeOS Generic Makefile v2.2 ##

## Fill in this file to specify the project being created, and the referenced
## makefile-engine will do all of the hard work for you.  This handles both
## Intel and PowerPC builds of the BeOS.

# Get version number from configure.ac
version := $(shell grep <configure.ac INIT_AUTOMAKE | sed -e 's/.*\[//' -e 's/\].*//')

## Application Specific Settings ---------------------------------------------

# specify the name of the binary
NAME=alephone

# specify the type of binary
#	APP:	Application
#	SHARED:	Shared library or add-on
#	STATIC:	Static library archive
#	DRIVER: Kernel Driver
TYPE=APP

#	add support for new Pe and Eddie features
#	to fill in generic makefile

#%{
# @src->@ 

#	specify the source files to use
#	full paths or paths relative to the makefile can be included
# 	all files, regardless of directory, will have their object
#	files created in the common object directory.
#	Note that this means this makefile will not work correctly
#	if two source files with the same name (source.c or source.cpp)
#	are included from different directories.  Also note that spaces
#	in folder names do not work well with this makefile.
CS=Source_Files/CSeries
EP=Source_Files/Expat
FI=Source_Files/Files
GW=Source_Files/GameWorld
IP=Source_Files/Input
MI=Source_Files/Misc
MV=Source_Files/ModelView
NW=Source_Files/Network
PF=Source_Files/Pfhortran
RM=Source_Files/RenderMain
RO=Source_Files/RenderOther
SN=Source_Files/Sound
XM=Source_Files/XML
SRCS=\
  $(CS)/byte_swapping.cpp $(CS)/csalerts_sdl.cpp $(CS)/cscluts_sdl.cpp \
  $(CS)/csdialogs_sdl.cpp $(CS)/csfiles_beos.cpp $(CS)/csmisc_sdl.cpp \
  $(CS)/csstrings_sdl.cpp $(CS)/mytm_sdl.cpp \
  \
  $(EP)/hashtable.c $(EP)/xmlparse.c $(EP)/xmlrole.c $(EP)/xmltok.c \
  \
  $(FI)/crc.cpp $(FI)/FileHandler_SDL.cpp $(FI)/find_files_sdl.cpp \
  $(FI)/game_wad.cpp $(FI)/import_definitions.cpp $(FI)/preprocess_map_sdl.cpp \
  $(FI)/resource_manager.cpp $(FI)/wad.cpp $(FI)/wad_prefs.cpp \
  $(FI)/wad_sdl.cpp $(FI)/Packing.cpp \
  \
  $(GW)/devices.cpp $(GW)/dynamic_limits.cpp $(GW)/effects.cpp \
  $(GW)/flood_map.cpp $(GW)/items.cpp $(GW)/lightsource.cpp \
  $(GW)/map_constructors.cpp $(GW)/map.cpp $(GW)/marathon2.cpp $(GW)/media.cpp \
  $(GW)/monsters.cpp $(GW)/pathfinding.cpp $(GW)/physics.cpp \
  $(GW)/placement.cpp $(GW)/platforms.cpp $(GW)/player.cpp \
  $(GW)/projectiles.cpp $(GW)/scenery.cpp $(GW)/weapons.cpp $(GW)/world.cpp \
  \
  $(IP)/mouse_sdl.cpp \
  \
  $(MI)/ActionQueues.cpp $(MI)/game_errors.cpp $(MI)/interface.cpp \
  $(MI)/interface_sdl.cpp $(MI)/PlayerImage_sdl.cpp $(MI)/PlayerName.cpp \
  $(MI)/preferences.cpp $(MI)/preferences_widgets_sdl.cpp \
  $(MI)/sdl_dialogs.cpp $(MI)/sdl_widgets.cpp \
  $(MI)/thread_priority_sdl_dummy.cpp $(MI)/vbl.cpp $(MI)/vbl_sdl.cpp \
  $(MI)/DefaultStringSets.cpp $(MI)/Logging.cpp \
  \
  $(MV)/Model3D.cpp $(MV)/ModelRenderer.cpp $(MV)/Dim3_Loader.cpp \
  $(MV)/StudioLoader.cpp $(MV)/WavefrontLoader.cpp \
  \
  $(NW)/network.cpp $(NW)/network_data_formats.cpp $(NW)/network_dialogs.cpp \
  $(NW)/network_dialogs_sdl.cpp $(NW)/network_dialog_widgets_sdl.cpp \
  $(NW)/network_games.cpp $(NW)/network_lookup_sdl.cpp \
  $(NW)/network_microphone_sdl_dummy.cpp $(NW)/network_speaker_sdl.cpp \
  $(NW)/network_stream.cpp $(NW)/network_tcp.cpp $(NW)/network_udp.cpp \
  $(NW)/SDL_netx.cpp $(NW)/SSLP_limited.cpp \
  $(NW)/network_microphone_shared.cpp $(NW)/network_speaker_shared.cpp \
  \
  $(PF)/script_instructions.cpp $(PF)/script_parser.cpp $(PF)/scripting.cpp \
  \
  $(RM)/AnimatedTextures.cpp $(RM)/Crosshairs_SDL.cpp \
  $(RM)/ImageLoader_SDL.cpp $(RM)/OGL_Faders.cpp $(RM)/OGL_Render.cpp \
  $(RM)/OGL_Setup.cpp $(RM)/OGL_Textures.cpp $(RM)/render.cpp \
  $(RM)/RenderPlaceObjs.cpp $(RM)/RenderRasterize.cpp $(RM)/RenderSortPoly.cpp \
  $(RM)/RenderVisTree.cpp $(RM)/scottish_textures.cpp $(RM)/shapes.cpp \
  $(RM)/textures.cpp \
  \
  $(RO)/ChaseCam.cpp $(RO)/computer_interface.cpp $(RO)/fades.cpp \
  $(RO)/FontHandler.cpp $(RO)/game_window.cpp $(RO)/game_window_sdl.cpp \
  $(RO)/HUDRenderer.cpp $(RO)/HUDRenderer_OGL.cpp $(RO)/HUDRenderer_SW.cpp \
  $(RO)/images.cpp $(RO)/motion_sensor.cpp $(RO)/overhead_map.cpp \
  $(RO)/OverheadMap_OGL.cpp $(RO)/OverheadMapRenderer.cpp \
  $(RO)/OverheadMap_SDL.cpp $(RO)/screen_drawing.cpp $(RO)/screen_sdl.cpp \
  $(RO)/sdl_fonts.cpp $(RO)/TextLayoutHelper.cpp $(RO)/TextStrings.cpp \
  $(RO)/ViewControl.cpp \
  \
  $(SN)/mysound.cpp \
  \
  $(XM)/ColorParser.cpp $(XM)/DamageParser.cpp $(XM)/ShapesParser.cpp \
  $(XM)/XML_Configure.cpp $(XM)/XML_DataBlock.cpp $(XM)/XML_ElementParser.cpp \
  $(XM)/XML_LevelScript.cpp $(XM)/XML_Loader_SDL.cpp $(XM)/XML_MakeRoot.cpp \
  \
  Source_Files/shell.cpp Source_Files/shell_misc.cpp

#	specify the resource files to use
#	full path or a relative path to the resource file can be used.
RSRCS= 

# @<-src@ 
#%}

#	end support for Pe and Eddie

#	specify additional libraries to link against
#	there are two acceptable forms of library specifications
#	-	if your library follows the naming pattern of:
#		libXXX.so or libXXX.a you can simply specify XXX
#		library: libbe.so entry: be
#		
#	- 	if your library does not follow the standard library
#		naming scheme you need to specify the path to the library
#		and it's name
#		library: my_lib.a entry: my_lib.a or path/my_lib.a
MACHINE=$(shell uname -m)
ifeq ($(MACHINE), BePC)
  LIBS=be stdc++.r4 SDL_image SDL_net png z
else
  LIBS=be SDL_image SDL_net png jpeg z
endif

#	specify additional paths to directories following the standard
#	libXXX.so or libXXX.a naming scheme.  You can specify full paths
#	or paths relative to the makefile.  The paths included may not
#	be recursive, so include all of the paths where libraries can
#	be found.  Directories where source files are found are
#	automatically included.
LIBPATHS=

#	additional paths to look for system headers
#	thes use the form: #include <header>
#	source file directories are NOT auto-included here
SYSTEM_INCLUDE_PATHS=

#	additional paths to look for local headers
#	thes use the form: #include "header"
#	source file directories are automatically included
LOCAL_INCLUDE_PATHS= 

#	specify the level of optimization that you desire
#	NONE, SOME, FULL
OPTIMIZE= FULL

#	specify any preprocessor symbols to be defined.  The symbols will not
#	have their values set automatically; you must supply the value (if any)
#	to use.  For example, setting DEFINES to "DEBUG=1" will cause the
#	compiler option "-DDEBUG=1" to be used.  Setting DEFINES to "DEBUG"
#	would pass "-DDEBUG" on the compiler's command line.
DEFINES= SDL HAVE_SDL_IMAGE_H HAVE_SDL_IMAGE HAVE_SDL_NET_H HAVE_SDL_NET HAVE_UNISTD_H VERSION=\"$(version)\"

#	specify special warning levels
#	if unspecified default warnings will be used
#	NONE = supress all warnings
#	ALL = enable all warnings
WARNINGS = 

#	specify whether image symbols will be created
#	so that stack crawls in the debugger are meaningful
#	if TRUE symbols will be created
SYMBOLS =

#	specify debug settings
#	if TRUE will allow application to be run from a source-level
#	debugger.  Note that this will disable all optimzation.
DEBUGGER = 

#	specify additional compiler flags for all files
COMPILER_FLAGS = `sdl-config --cflags`

#	specify additional linker flags
LINKER_FLAGS = `sdl-config --static-libs`

#	specify the version of this particular item
#	(for example, -app 3 4 0 d 0 -short 340 -long "340 "`echo -n -e '\302\251'`"1999 GNU GPL") 
#	This may also be specified in a resource.
APP_VERSION = 

#	(for TYPE == DRIVER only) Specify desired location of driver in the /dev
#	hierarchy. Used by the driverinstall rule. E.g., DRIVER_PATH = video/usb will
#	instruct the driverinstall rule to place a symlink to your driver's binary in
#	~/add-ons/kernel/drivers/dev/video/usb, so that your driver will appear at
#	/dev/video/usb when loaded. Default is "misc".
DRIVER_PATH = 

## include the makefile-engine
include $(BUILDHOME)/etc/makefile-engine

# Install under BeOS
INSTALLDIR = /boot/home/AlephOne
install: $(TARGET)
	mkdir -p $(INSTALLDIR)
	mkdir -p $(INSTALLDIR)/MML
	mkdir -p $(INSTALLDIR)/Themes/Default
	cp $(TARGET) $(INSTALLDIR)/AlephOne
	cp data/Fonts $(INSTALLDIR)
	cp data/*.mml $(INSTALLDIR)/MML
	cp data/default_theme/*.bmp $(INSTALLDIR)/Themes/Default
	cp data/default_theme/resources $(INSTALLDIR)/Themes/Default
	cp data/default_theme/theme.mml $(INSTALLDIR)/Themes/Default
	mimeset -f $(INSTALLDIR)

# Make BeOS binary distribution
distdir = AlephOne-$(version)
dist: $(TARGET)
	-rm -rf $(distdir)
	mkdir $(distdir)
	mkdir $(distdir)/MML
	mkdir $(distdir)/docs
	mkdir -p $(distdir)/Themes/Default
	cp $(TARGET) $(distdir)/AlephOne
	cp README INSTALL.BeOS COPYING COPYING.SDL $(distdir)
	cp data/Fonts $(distdir)
	cp data/*.mml $(distdir)/MML
	cp docs/MML.html docs/Cheat_Codes $(distdir)/docs
	cp data/default_theme/*.bmp $(distdir)/Themes/Default
	cp data/default_theme/resources $(distdir)/Themes/Default
	cp data/default_theme/theme.mml $(distdir)/Themes/Default
	mimeset -f $(distdir)
	zip -ry AlephOne-$(version)-BeOS-$(CPU).zip $(distdir)
	rm -rf $(distdir)
