[go: up one dir, main page]

Menu

[r7]: / engine / makefile.lin  Maximize  Restore  History

Download this file

193 lines (148 with data), 4.8 kB

#####################################
#                                   #
#  Makefile for IRE, Linux version  #
#                                   #
#####################################

# Define all the targets first
all: library_bgui2 library_ithe ire-engine ire-ed chknpc crypter resize png2cel cel2png # mover

##
##  Configurables:
##

# Where to put binary on 'make install'?
INSTALL_BIN = $/usr/games
     
# Where to put data on 'make install'?
INSTALL_DATA = $/usr/share/games/ire/data

# Where to put data on 'make install'?
INI_FILES = $/etc/ire

# Debugging and profiling
#PROF += -pg
DBG += -g -O0

# Optimisation
ifeq ($(DBG),)
OPT = -O2
endif

# Pick one of the following sound libraries:
# SOUND = fmod3		# Higher quality, but non-Free
# SOUND = fmod4		# Higher quality, but non-Free (experimental)
# SOUND = allegro	# Lower quality, but fully-Free
# SOUND = sdl		# Higher quality, fully-Free, needs SDL_mixer
# SOUND = none		# Nothing

SOUND = sdl

# Choose whether to use the X86 assembly optimisations
# ASM = asm		# Use optional assembly code
# ASM = no_asm		# no assembly code

ASM = no_asm

##
##  Okay, do the stuff
##

# FMOD3 sound library.  May need tweaking
ifeq ($(SOUND),fmod3)
	SOUNDLIB_C       = -DUSE_FMOD3
			  # Force IRE to load the FMOD library from current dir
	SOUNDLIB_L       = -lfmod-3.70 -L. -Xlinker -rpath .
endif

# FMOD4 sound library.  May need tweaking
ifeq ($(SOUND),fmod4)
	SOUNDLIB_C       = -DUSE_FMOD4
			  # Force IRE to load the FMOD library from current dir
#	SOUNDLIB_L       = -lfmod-3.6 -L. -Xlinker -rpath .
	SOUNDLIB_L       = -lfmodex
endif

# ALLEGRO sound library with ALOGG.
ifeq ($(SOUND),allegro)
	SOUNDLIB_C	 = -DUSE_ALOGG -DUSE_ALSOUND `alogg-config --cflags`
	SOUNDLIB_L	 = `alogg-config --libs`
endif

# SDL sound library
ifeq ($(SOUND),sdl)
	SOUNDLIB_C	 = -DUSE_SDLSOUND `sdl-config --cflags`
	SOUNDLIB_L	 = `sdl-config --libs` -lSDL_mixer
endif

# No sound library
ifeq ($(SOUND),none)
	SOUNDLIB_C	 = -DUSE_NOSOUND
	SOUNDLIB_L	 = 
endif

# Use the C or C++ compiler
CC                = gcc
LD		  = gcc
#CFLAGS            = -march=pentium -Wall 
#CFLAGS            = -O3
CFLAGS 		  =  $(OPT) -Wall -Wno-write-strings  $(PROF) $(DBG) $(SOUNDLIB_C)
CFLAGS           += -I. -DPATH_FILES_DAT=\"/$(INSTALL_DATA)/\" -DPATH_FILES_CONF=\"/$(INI_FILES)/\" -DALLEGRO -DBGUI `allegro-config --cflags`
#LDFLAGS		  = `allegro-config --static`
LDFLAGS		  = `allegro-config --libs` $(PROF) $(DBG)

Xopts		  = -Llibs/linux

Lib_files         = -lithe -ljpeg -lpng -lbgui -lstdc++ -lX11 -lXext

ifeq ($(ASM),no_asm)
	CFLAGS	 += -DNO_ASM
endif	

# include the BGUI2 library
include deb/makefile.bgui2

# include the IT-HE support library
include deb/makefile.ithe

# Include the makefile core
include makefile.all

# Linux-dependent components
lin_obj += audio/fmod3.o audio/fmod4.o audio/allegro.o audio/sdl.o audio/nosound.o
ifneq ($(ASM),no_asm)
	lin_obj += darken_a.o 
endif


# Makefile rules

ire-engine: $(ire_obj) $(lin_obj)
	$(LD) $(Xopts) $(ire_obj) $(lin_obj) $(Lib_files) -o ../ire-engine $(LDFLAGS) $(SOUNDLIB_L)
	-rm -f ire.o

ire-ed: $(ed_obj) $(lin_obj)
	$(LD) $(Xopts) $(ed_obj) $(lin_obj) $(Lib_files) -o ../ire-ed $(LDFLAGS) $(SOUNDLIB_L)
	-rm -f editor.o

resedit: $(res_obj)
	$(LD)  $(Xopts) $(res_obj) $(Lib_files) -o res $(LDFLAGS)
	-rm -f res.o

resize: $(resize_obj)
	$(LD) $(Xopts) $(resize_obj) -lithe -ljpeg -o tools/resize_map $(LDFLAGS) -lstdc++

mover: $(move_obj)
	$(LD) $(Xopts) $(move_obj) -lithe -ljpeg -o tools/mover $(LDFLAGS)

chknpc: $(chknpc_obj)
	$(LD) $(chknpc_obj) -o tools/chknpc

crypter: $(crypter_obj)
	$(LD) $(crypter_obj) -o tools/crypter

png2cel: $(png2cel_obj)
	$(LD) $(png2cel_obj) -lpng -o tools/png2cel

cel2png: $(cel2png_obj)
	$(LD) $(cel2png_obj) -lpng -o tools/cel2png

%.o: %.c
	$(CC) -c $(CFLAGS) $< -o $@

%.o: %.cc
	$(CC) -c $(CFLAGS) $< -o $@

%.o: %.cpp
	$(CC) -c $(CFLAGS) $< -o $@

%.o: %.S
	$(CC) -c $(CFLAGS) $< -o $@

ifeq ($(ASM),asm)
%.o: %.asm
	nasm -f elf $< -o $@
endif

clean:
	-rm -f $(ire_obj) $(ed_obj) $(resize_obj) $(chknpc_obj)
	-rm -f $(lin_obj) $(crypter_obj) $(move_obj) $(png2cel_obj) $(cel2png_obj)
	-rm -f $(Object_ithe) $(Object_bgui2)
	-rm -f ../ire-engine
	-rm -f ../ire-ed
	-rm -f tools/chknpc
	-rm -f tools/crypter
	-rm -f tools/resize_map

distclean:
	-rm -f $(ire_obj) $(ed_obj) $(resize_obj) $(chknpc_obj)
	-rm -f $(lin_obj) $(crypter_obj) $(move_obj) $(png2cel_obj) $(cel2png_obj)
	-rm -f $(Object_ithe) $(Object_bgui2)
	-rm -f ../ire-engine
	-rm -f ../ire-ed
	-rm -f bootlog.* game.cfg
	-rm -f tools/*
	-rm -f $(library_ithe)
	-rm -f $(library_bgui2)

install:
		install -d $(INSTALL_BIN) $(INSTALL_DATA) $(INI_FILES)
		install ../ire-engine $(INSTALL_BIN)
		install ../ire-ed $(INSTALL_BIN)
		install -m644 ../game.ini $(INI_FILES)/game.ini