diff --git a/config b/config index 8e1bf33..9325826 100644 --- a/config +++ b/config @@ -1,27 +1,28 @@ #Config file for ZEngine# #Edit only this file# -BUILD= ZEngine-0.8.4 +BUILD_NAME=ZEngine-0.8.4 -#Define compiler commands: -CC= g++ -AR= ar rcs + ###Cygwin### +#EXE=.exe +#GL_LIB_NAME=OpenGL32 +#GL_INC_PATH=-I/usr/include/w32api/GL +#GL_LIB_PATH=-L/lib/w32api -#Define compiler options: -WARN=-W -Wall -LIBS=-lZEngineS -lSDL_mixer -lSDL_image -lSDL_ttf -lSDLmain -lSDL -lGL -INC_PATH=-I/usr/include/SDL + ###Linux### +GL_LIB_NAME=GL -#Define install location: -INSTALL_ROOT= /usr/local -INSTALL_INC= $(INSTALL_ROOT)/include/$(BUILD) -INSTALL_LIB= $(INSTALL_ROOT)/lib -INSTALL_DOC= $(INSTALL_ROOT)/doc/$(BUILD) +##Define compiler commands: +CC=g++ +AR=ar rcs -############change nothing below this line################# -LIB= $(ZE)/lib -SRC= $(ZE)/src -TEST = $(ZE)/test +###Define compiler options: +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) -INCLUDE_PATH = -I$(ZE)/include $(INC_PATH) -CFLAGS = -O2 $(WARN) $(INCLUDE_PATH) +##Define install location: +INSTALL_INC= /usr/local/include/$(BUILD_NAME) +INSTALL_LIB= /usr/local/lib +INSTALL_DOC= /usr/local/doc/$(BUILD_NAME) diff --git a/makefile b/makefile index f9c736b..fb7e24f 100644 --- a/makefile +++ b/makefile @@ -1,53 +1,97 @@ #Makefile for ZEngine -ZE = . -include $(ZE)/config +#defines the user shouldn't change# +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 - -LIB_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 +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_OBJECTS = SDLGL_Util.o VersionInfo.o ZE_Utility.o ZE_ZClient.o ZE_ZConfigFile.o \ +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_ZServer.o ZE_ZSound.o ZE_ZTimer.o physfsrwops.o #build targets# -libZEngineS.a: $(SOURCES) - $(CC) $(CFLAGS) -c $(LIB_SOURCES) - $(AR) $(LIB_OUT) $(LIB_OBJECTS) +$(LIB_OUT): $(SOURCES) + @echo Building $(BUILD_NAME)... + $(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)/ZTimerTest.cpp $(TEST)/ZImageTest.cpp $(TEST)/ZRectTest.cpp $(TEST)/ZParticleTest.cpp - $(CC) $(CFLAGS) -L$(ZE)/lib $(TEST)/ZFontTest.cpp -o $(TEST)/bin/ZFontTest $(LIBS) - $(CC) $(CFLAGS) -L$(ZE)/lib $(TEST)/ZMouseTest.cpp -o $(TEST)/bin/ZMouseTest $(LIBS) - $(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) - $(CC) $(CFLAGS) -L$(ZE)/lib $(TEST)/ZTimerTest.cpp -o $(TEST)/bin/ZTimerTest $(LIBS) - $(CC) $(CFLAGS) -L$(ZE)/lib $(TEST)/ZImageTest.cpp -o $(TEST)/bin/ZImageTest $(LIBS) - $(CC) $(CFLAGS) -L$(ZE)/lib $(TEST)/ZRectTest.cpp -o $(TEST)/bin/ZRectTest $(LIBS) - $(CC) $(CFLAGS) -L$(ZE)/lib $(TEST)/ZParticleTest.cpp -o $(TEST)/bin/ZParticleTest $(LIBS) +./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. + +./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) install: $(LIB_OUT) - mkdir -p $(INSTALL_ROOT) mkdir -p $(INSTALL_INC) mkdir -p $(INSTALL_LIB) mkdir -p $(INSTALL_DOC) - cp -r $(ZE)/include/* $(INSTALL_INC) + cp -r ./include/* $(INSTALL_INC) cp $(LIB_OUT) $(INSTALL_LIB) - cp -r $(ZE)/doc/html/* $(INSTALL_DOC) - - -.PHONY: clean veryclean + cp -r ./doc/html/* $(INSTALL_DOC) clean: rm -f *.o + @echo All object files removed. veryclean: rm -f *.o - rm -f $(TEST)/bin/*.exe - rm -f $(LIB_OUT) \ No newline at end of file + rm -f ./test/bin/*.exe + rm -f $(LIB_OUT) + @echo All output files removed.