atani's updated build system
This commit is contained in:
parent
2bc912e275
commit
5215e6eba5
4
config
4
config
@ -8,11 +8,9 @@ BUILD_NAME=ZEngine-0.8.4
|
||||
#GL_LIB_NAME=OpenGL32
|
||||
#GL_INC_PATH=-I/usr/include/w32api/GL
|
||||
#GL_LIB_PATH=-L/lib/w32api
|
||||
#EXTRA_OPTIONS=-mno-cygwin -O2
|
||||
|
||||
###Linux###
|
||||
GL_LIB_NAME=GL
|
||||
EXTRA_OPTIONS=-O2
|
||||
|
||||
##Define compiler commands:
|
||||
CC=g++
|
||||
@ -23,6 +21,8 @@ WARN_LEVEL=-W -Wall
|
||||
SDL_INC_PATH=-I/usr/local/include/SDL
|
||||
SDL_LIB_PATH=-L/usr/local/lib/
|
||||
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:
|
||||
INSTALL_INC= /usr/local/include/$(BUILD_NAME)
|
||||
|
95
makefile
95
makefile
@ -1,98 +1,57 @@
|
||||
#Makefile for ZEngine
|
||||
|
||||
include ./config
|
||||
include $(CURDIR)/config
|
||||
#defines the user shouldn't change#
|
||||
INCLUDES = -I./include $(SDL_INC_PATH) $(GL_INC_PATH)
|
||||
LIBRARIES = -L./lib $(SDL_LIB_PATH) $(GL_LIB_PATH)
|
||||
INCLUDES = -I$(CURDIR)/include $(SDL_INC_PATH) $(GL_INC_PATH)
|
||||
LIBRARIES = -L$(CURDIR)/lib $(SDL_LIB_PATH) $(GL_LIB_PATH)
|
||||
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
|
||||
|
||||
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
|
||||
%.o: $(CURDIR)/src/%.cpp
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
%.o: $(CURDIR)/src/external/%.cpp
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
SOURCES = $(wildcard $(CURDIR)/src/external/*.cpp) \
|
||||
$(wildcard $(CURDIR)/src/*.cpp)
|
||||
|
||||
#SOURCES with path stripped and .cpp changed to .o
|
||||
OBJECTS = $(notdir $(SOURCES:.cpp=.o))
|
||||
|
||||
#build targets#
|
||||
|
||||
$(LIB_OUT): $(SOURCES)
|
||||
all: $(LIB_OUT) tests
|
||||
tests: $(ALL_TESTS)
|
||||
|
||||
$(LIB_OUT): $(OBJECTS)
|
||||
@echo Building $(BUILD_NAME)...
|
||||
$(CC) $(CFLAGS) -c $(SOURCES)
|
||||
$(AR) $(LIB_OUT) $(OBJECTS)
|
||||
@echo Built $(BUILD_NAME).
|
||||
|
||||
./test/bin/ZFontTest$(EXE) : $(LIB_OUT) ./test/ZFontTest.cpp
|
||||
@echo Building ZFontTest...
|
||||
$(CC) $(CFLAGS) ./test/ZFontTest.cpp -o ./test/bin/ZFontTest$(EXE) $(LIBS)
|
||||
@echo ZFontTest compiled.
|
||||
$(ALL_TESTS) : $(LIB_OUT)
|
||||
@echo Building $@...
|
||||
$(CC) $(CFLAGS) $(CURDIR)/test/$@.cpp -o $(CURDIR)/test/bin/$@$(EXE) $(LIBS)
|
||||
@echo $@ compiled.
|
||||
|
||||
./test/bin/ZMouseTest$(EXE) : $(LIB_OUT) ./test/ZMouseTest.cpp
|
||||
@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)
|
||||
.PHONY: $(ALL_TESTS) install clean veryclean
|
||||
|
||||
install: $(LIB_OUT)
|
||||
mkdir -p $(INSTALL_INC)
|
||||
mkdir -p $(INSTALL_LIB)
|
||||
mkdir -p $(INSTALL_DOC)
|
||||
cp -r ./include/* $(INSTALL_INC)
|
||||
cp -r $(CURDIR)/include/* $(INSTALL_INC)
|
||||
cp $(LIB_OUT) $(INSTALL_LIB)
|
||||
cp -r ./doc/html/* $(INSTALL_DOC)
|
||||
cp -r $(CURDIR)/doc/html/* $(INSTALL_DOC)
|
||||
|
||||
clean:
|
||||
rm -f *.o
|
||||
rm -f $(OBJECTS)
|
||||
@echo All object files removed.
|
||||
|
||||
veryclean:
|
||||
rm -f *.o
|
||||
rm -f ./test/bin/*.exe
|
||||
rm -f $(OBJECTS)
|
||||
rm -f $(CURDIR)/test/bin/*$(EXE)
|
||||
rm -f $(LIB_OUT)
|
||||
@echo All output files removed.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user