atani's updated build system

This commit is contained in:
James Turk 2003-07-28 00:04:02 +00:00
parent 2bc912e275
commit 5215e6eba5
2 changed files with 29 additions and 70 deletions

4
config
View File

@ -8,11 +8,9 @@ BUILD_NAME=ZEngine-0.8.4
#GL_LIB_NAME=OpenGL32 #GL_LIB_NAME=OpenGL32
#GL_INC_PATH=-I/usr/include/w32api/GL #GL_INC_PATH=-I/usr/include/w32api/GL
#GL_LIB_PATH=-L/lib/w32api #GL_LIB_PATH=-L/lib/w32api
#EXTRA_OPTIONS=-mno-cygwin -O2
###Linux### ###Linux###
GL_LIB_NAME=GL GL_LIB_NAME=GL
EXTRA_OPTIONS=-O2
##Define compiler commands: ##Define compiler commands:
CC=g++ CC=g++
@ -23,6 +21,8 @@ WARN_LEVEL=-W -Wall
SDL_INC_PATH=-I/usr/local/include/SDL SDL_INC_PATH=-I/usr/local/include/SDL
SDL_LIB_PATH=-L/usr/local/lib/ SDL_LIB_PATH=-L/usr/local/lib/
LIBS=-lZEngineS -lSDL_mixer -lSDL_image -lSDL_ttf -lSDLmain -lSDL -l$(GL_LIB_NAME) LIBS=-lZEngineS -lSDL_mixer -lSDL_image -lSDL_ttf -lSDLmain -lSDL -l$(GL_LIB_NAME)
EXTRA_OPTIONS=-O2
#add -mno-cygwin if compiling lib for non-cygwin g++ on windows
##Define install location: ##Define install location:
INSTALL_INC= /usr/local/include/$(BUILD_NAME) INSTALL_INC= /usr/local/include/$(BUILD_NAME)

View File

@ -1,98 +1,57 @@
#Makefile for ZEngine #Makefile for ZEngine
include ./config include $(CURDIR)/config
#defines the user shouldn't change# #defines the user shouldn't change#
INCLUDES = -I./include $(SDL_INC_PATH) $(GL_INC_PATH) INCLUDES = -I$(CURDIR)/include $(SDL_INC_PATH) $(GL_INC_PATH)
LIBRARIES = -L./lib $(SDL_LIB_PATH) $(GL_LIB_PATH) LIBRARIES = -L$(CURDIR)/lib $(SDL_LIB_PATH) $(GL_LIB_PATH)
CFLAGS = $(EXTRA_OPTIONS) $(WARN_LEVEL) $(INCLUDES) $(LIBRARIES) CFLAGS = $(EXTRA_OPTIONS) $(WARN_LEVEL) $(INCLUDES) $(LIBRARIES)
LIB_OUT = ./lib/libZEngineS.a LIB_OUT = $(CURDIR)/lib/libZEngineS.a
ALL_TESTS = ZFontTest ZMouseTest ZMusicTest ZSoundTest ZTimerTest ZImageTest ZRectTest ZParticleTest ALL_TESTS = ZFontTest ZMouseTest ZMusicTest ZSoundTest ZTimerTest ZImageTest ZRectTest ZParticleTest
SOURCES = ./src/external/SDLGL_Util.cpp ./src/VersionInfo.cpp ./src/ZE_Utility.cpp \ %.o: $(CURDIR)/src/%.cpp
./src/ZE_ZClient.cpp ./src/ZE_ZConfigFile.cpp ./src/ZE_ZEngine.cpp \ $(CC) $(CFLAGS) -c $< -o $@
./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 \ %.o: $(CURDIR)/src/external/%.cpp
./src/ZE_ZTimer.cpp ./src/external/physfsrwops.cpp $(CC) $(CFLAGS) -c $< -o $@
SOURCES = $(wildcard $(CURDIR)/src/external/*.cpp) \
$(wildcard $(CURDIR)/src/*.cpp)
#SOURCES with path stripped and .cpp changed to .o #SOURCES with path stripped and .cpp changed to .o
OBJECTS = $(notdir $(SOURCES:.cpp=.o)) OBJECTS = $(notdir $(SOURCES:.cpp=.o))
#build targets# #build targets#
$(LIB_OUT): $(SOURCES) all: $(LIB_OUT) tests
tests: $(ALL_TESTS)
$(LIB_OUT): $(OBJECTS)
@echo Building $(BUILD_NAME)... @echo Building $(BUILD_NAME)...
$(CC) $(CFLAGS) -c $(SOURCES)
$(AR) $(LIB_OUT) $(OBJECTS) $(AR) $(LIB_OUT) $(OBJECTS)
@echo Built $(BUILD_NAME). @echo Built $(BUILD_NAME).
./test/bin/ZFontTest$(EXE) : $(LIB_OUT) ./test/ZFontTest.cpp $(ALL_TESTS) : $(LIB_OUT)
@echo Building ZFontTest... @echo Building $@...
$(CC) $(CFLAGS) ./test/ZFontTest.cpp -o ./test/bin/ZFontTest$(EXE) $(LIBS) $(CC) $(CFLAGS) $(CURDIR)/test/$@.cpp -o $(CURDIR)/test/bin/$@$(EXE) $(LIBS)
@echo ZFontTest compiled. @echo $@ compiled.
./test/bin/ZMouseTest$(EXE) : $(LIB_OUT) ./test/ZMouseTest.cpp .PHONY: $(ALL_TESTS) install clean veryclean
@echo Building ZMouseTest...
$(CC) $(CFLAGS) ./test/ZMouseTest.cpp -o ./test/bin/ZMouseTest$(EXE) $(LIBS)
@echo ZMouseTest compiled.
./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_INC) mkdir -p $(INSTALL_INC)
mkdir -p $(INSTALL_LIB) mkdir -p $(INSTALL_LIB)
mkdir -p $(INSTALL_DOC) mkdir -p $(INSTALL_DOC)
cp -r ./include/* $(INSTALL_INC) cp -r $(CURDIR)/include/* $(INSTALL_INC)
cp $(LIB_OUT) $(INSTALL_LIB) cp $(LIB_OUT) $(INSTALL_LIB)
cp -r ./doc/html/* $(INSTALL_DOC) cp -r $(CURDIR)/doc/html/* $(INSTALL_DOC)
clean: clean:
rm -f *.o rm -f $(OBJECTS)
@echo All object files removed. @echo All object files removed.
veryclean: veryclean:
rm -f *.o rm -f $(OBJECTS)
rm -f ./test/bin/*.exe rm -f $(CURDIR)/test/bin/*$(EXE)
rm -f $(LIB_OUT) rm -f $(LIB_OUT)
@echo All output files removed. @echo All output files removed.