better config and makefile

This commit is contained in:
James Turk 2003-07-15 11:11:25 +00:00
parent f17dfb698c
commit a9a3b8c316
2 changed files with 95 additions and 50 deletions

39
config
View File

@ -1,27 +1,28 @@
#Config file for ZEngine# #Config file for ZEngine#
#Edit only this file# #Edit only this file#
BUILD= ZEngine-0.8.4 BUILD_NAME=ZEngine-0.8.4
#Define compiler commands: ###Cygwin###
CC= g++ #EXE=.exe
AR= ar rcs #GL_LIB_NAME=OpenGL32
#GL_INC_PATH=-I/usr/include/w32api/GL
#GL_LIB_PATH=-L/lib/w32api
#Define compiler options: ###Linux###
WARN=-W -Wall GL_LIB_NAME=GL
LIBS=-lZEngineS -lSDL_mixer -lSDL_image -lSDL_ttf -lSDLmain -lSDL -lGL
INC_PATH=-I/usr/include/SDL
#Define install location: ##Define compiler commands:
INSTALL_ROOT= /usr/local CC=g++
INSTALL_INC= $(INSTALL_ROOT)/include/$(BUILD) AR=ar rcs
INSTALL_LIB= $(INSTALL_ROOT)/lib
INSTALL_DOC= $(INSTALL_ROOT)/doc/$(BUILD)
############change nothing below this line################# ###Define compiler options:
LIB= $(ZE)/lib WARN_LEVEL=-W -Wall
SRC= $(ZE)/src SDL_INC_PATH=-I/usr/local/include/SDL
TEST = $(ZE)/test SDL_LIB_PATH=-L/usr/local/lib/
LIBS=-lZEngineS -lSDL_mixer -lSDL_image -lSDL_ttf -lSDLmain -lSDL -l$(GL_LIB_NAME)
INCLUDE_PATH = -I$(ZE)/include $(INC_PATH) ##Define install location:
CFLAGS = -O2 $(WARN) $(INCLUDE_PATH) INSTALL_INC= /usr/local/include/$(BUILD_NAME)
INSTALL_LIB= /usr/local/lib
INSTALL_DOC= /usr/local/doc/$(BUILD_NAME)

104
makefile
View File

@ -1,53 +1,97 @@
#Makefile for ZEngine #Makefile for ZEngine
ZE = . #defines the user shouldn't change#
include $(ZE)/config include ./config
CFLAGS = -O2 $(WARN_LEVEL) -I./include $(SDL_INC_PATH) $(GL_INC_PATH) -L./lib $(SDL_LIB_PATH) $(GL_LIB_PATH)
LIB_OUT = ./lib/libZEngineS.a
ALL_TESTS = ZFontTest ZMouseTest ZMusicTest ZSoundTest ZTimerTest ZImageTest ZRectTest ZParticleTest
LIB_OUT = $(ZE)/lib/libZEngineS.a SOURCES = ./src/external/SDLGL_Util.cpp ./src/VersionInfo.cpp ./src/ZE_Utility.cpp \
./src/ZE_ZClient.cpp ./src/ZE_ZConfigFile.cpp ./src/ZE_ZEngine.cpp \
./src/ZE_ZError.cpp ./src/ZE_ZFont.cpp ./src/ZE_ZImage.cpp ./src/ZE_ZMusic.cpp \
./src/ZE_ZRandGen.cpp ./src/ZE_ZRect.cpp ./src/ZE_ZServer.cpp ./src/ZE_ZSound.cpp \
./src/ZE_ZTimer.cpp ./src/external/physfsrwops.cpp
LIB_SOURCES = $(SRC)/external/SDLGL_Util.cpp $(SRC)/VersionInfo.cpp $(SRC)/ZE_Utility.cpp \ OBJECTS = SDLGL_Util.o VersionInfo.o ZE_Utility.o ZE_ZClient.o ZE_ZConfigFile.o \
$(SRC)/ZE_ZClient.cpp $(SRC)/ZE_ZConfigFile.cpp $(SRC)/ZE_ZEngine.cpp \
$(SRC)/ZE_ZError.cpp $(SRC)/ZE_ZFont.cpp $(SRC)/ZE_ZImage.cpp $(SRC)/ZE_ZMusic.cpp \
$(SRC)/ZE_ZRandGen.cpp $(SRC)/ZE_ZRect.cpp $(SRC)/ZE_ZServer.cpp $(SRC)/ZE_ZSound.cpp \
$(SRC)/ZE_ZTimer.cpp $(SRC)/external/physfsrwops.cpp
LIB_OBJECTS = SDLGL_Util.o VersionInfo.o ZE_Utility.o ZE_ZClient.o ZE_ZConfigFile.o \
ZE_ZEngine.o ZE_ZError.o ZE_ZFont.o ZE_ZImage.o ZE_ZMusic.o ZE_ZRandGen.o ZE_ZRect.o \ ZE_ZEngine.o ZE_ZError.o ZE_ZFont.o ZE_ZImage.o ZE_ZMusic.o ZE_ZRandGen.o ZE_ZRect.o \
ZE_ZServer.o ZE_ZSound.o ZE_ZTimer.o physfsrwops.o ZE_ZServer.o ZE_ZSound.o ZE_ZTimer.o physfsrwops.o
#build targets# #build targets#
libZEngineS.a: $(SOURCES) $(LIB_OUT): $(SOURCES)
$(CC) $(CFLAGS) -c $(LIB_SOURCES) @echo Building $(BUILD_NAME)...
$(AR) $(LIB_OUT) $(LIB_OBJECTS) $(CC) $(CFLAGS) -c $(SOURCES)
$(AR) $(LIB_OUT) $(OBJECTS)
@echo Built $(BUILD_NAME).
tests: $(TEST)/ZFontTest.cpp $(TEST)/ZMouseTest.cpp $(TEST)/ZMusicTest.cpp $(TEST)/ZSoundTest.cpp \ ./test/bin/ZFontTest$(EXE) : $(LIB_OUT) ./test/ZFontTest.cpp
$(TEST)/ZTimerTest.cpp $(TEST)/ZImageTest.cpp $(TEST)/ZRectTest.cpp $(TEST)/ZParticleTest.cpp @echo Building ZFontTest...
$(CC) $(CFLAGS) -L$(ZE)/lib $(TEST)/ZFontTest.cpp -o $(TEST)/bin/ZFontTest $(LIBS) $(CC) $(CFLAGS) ./test/ZFontTest.cpp -o ./test/bin/ZFontTest$(EXE) $(LIBS)
$(CC) $(CFLAGS) -L$(ZE)/lib $(TEST)/ZMouseTest.cpp -o $(TEST)/bin/ZMouseTest $(LIBS) @echo ZFontTest compiled.
$(CC) $(CFLAGS) -L$(ZE)/lib $(TEST)/ZMusicTest.cpp -o $(TEST)/bin/ZMusicTest $(LIBS)
$(CC) $(CFLAGS) -L$(ZE)/lib $(TEST)/ZSoundTest.cpp -o $(TEST)/bin/ZSoundTest $(LIBS) ./test/bin/ZMouseTest$(EXE) : $(LIB_OUT) ./test/ZMouseTest.cpp
$(CC) $(CFLAGS) -L$(ZE)/lib $(TEST)/ZTimerTest.cpp -o $(TEST)/bin/ZTimerTest $(LIBS) @echo Building ZMouseTest...
$(CC) $(CFLAGS) -L$(ZE)/lib $(TEST)/ZImageTest.cpp -o $(TEST)/bin/ZImageTest $(LIBS) $(CC) $(CFLAGS) ./test/ZMouseTest.cpp -o ./test/bin/ZMouseTest$(EXE) $(LIBS)
$(CC) $(CFLAGS) -L$(ZE)/lib $(TEST)/ZRectTest.cpp -o $(TEST)/bin/ZRectTest $(LIBS) @echo ZMouseTest compiled.
$(CC) $(CFLAGS) -L$(ZE)/lib $(TEST)/ZParticleTest.cpp -o $(TEST)/bin/ZParticleTest $(LIBS)
./test/bin/ZMusicTest$(EXE) : $(LIB_OUT) ./test/ZMusicTest.cpp
@echo Building ZMusicTest...
$(CC) $(CFLAGS) ./test/ZMusicTest.cpp -o ./test/bin/ZMusicTest$(EXE) $(LIBS)
@echo ZMusicTest compiled.
./test/bin/ZSoundTest$(EXE) : $(LIB_OUT) ./test/ZSoundTest.cpp
@echo Building ZSoundTest...
$(CC) $(CFLAGS) ./test/ZSoundTest.cpp -o ./test/bin/ZSoundTest$(EXE) $(LIBS)
@echo ZSoundTest compiled.
./test/bin/ZTimerTest$(EXE) : $(LIB_OUT) ./test/ZTimerTest.cpp
@echo Building ZTimerTest...
$(CC) $(CFLAGS) ./test/ZTimerTest.cpp -o ./test/bin/ZTimerTest$(EXE) $(LIBS)
@echo ZTimerTest compiled.
./test/bin/ZImageTest$(EXE) : $(LIB_OUT) ./test/ZImageTest.cpp
@echo Building ZImageTest...
$(CC) $(CFLAGS) ./test/ZImageTest.cpp -o ./test/bin/ZImageTest$(EXE) $(LIBS)
@echo ZImageTest compiled.
./test/bin/ZRectTest$(EXE) : $(LIB_OUT) ./test/ZRectTest.cpp
@echo Building ZRectTest...
$(CC) $(CFLAGS) ./test/ZRectTest.cpp -o ./test/bin/ZRectTest$(EXE) $(LIBS)
@echo ZRectTest compiled.
./test/bin/ZParticleTest$(EXE) : $(LIB_OUT) ./test/ZParticleTest.cpp
@echo Building ZParticleTest...
$(CC) $(CFLAGS) ./test/ZParticleTest.cpp -o ./test/bin/ZParticleTest$(EXE) $(LIBS)
@echo ZParticleTest compiled.
.PHONY: $(ALL_TESTS) tests all install clean veryclean
ZFontTest: ./test/bin/ZFontTest$(EXE)
ZMouseTest: ./test/bin/ZMouseTest$(EXE)
ZMusicTest: ./test/bin/ZMusicTest$(EXE)
ZSoundTest: ./test/bin/ZSoundTest$(EXE)
ZTimerTest: ./test/bin/ZTimerTest$(EXE)
ZImageTest: ./test/bin/ZImageTest$(EXE)
ZRectTest: ./test/bin/ZRectTest$(EXE)
ZParticleTest: ./test/bin/ZParticleTest$(EXE)
tests: $(ALL_TESTS)
all: $(LIB_OUT) $(ALL_TESTS)
install: $(LIB_OUT) install: $(LIB_OUT)
mkdir -p $(INSTALL_ROOT)
mkdir -p $(INSTALL_INC) mkdir -p $(INSTALL_INC)
mkdir -p $(INSTALL_LIB) mkdir -p $(INSTALL_LIB)
mkdir -p $(INSTALL_DOC) mkdir -p $(INSTALL_DOC)
cp -r $(ZE)/include/* $(INSTALL_INC) cp -r ./include/* $(INSTALL_INC)
cp $(LIB_OUT) $(INSTALL_LIB) cp $(LIB_OUT) $(INSTALL_LIB)
cp -r $(ZE)/doc/html/* $(INSTALL_DOC) cp -r ./doc/html/* $(INSTALL_DOC)
.PHONY: clean veryclean
clean: clean:
rm -f *.o rm -f *.o
@echo All object files removed.
veryclean: veryclean:
rm -f *.o rm -f *.o
rm -f $(TEST)/bin/*.exe rm -f ./test/bin/*.exe
rm -f $(LIB_OUT) rm -f $(LIB_OUT)
@echo All output files removed.