diff --git a/.gitignore b/.gitignore index ff59976..4296d84 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ Makefile .vs -/build-*/ +/build-* /.settings/ diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 8d23944..0000000 --- a/.travis.yml +++ /dev/null @@ -1,13 +0,0 @@ -language: cpp -compiler: -- gcc -env: -- TARGET=Debug -- TARGET=Optimized -- TARGET=Release -before_install: -- sudo apt-get update -qq -- sudo apt-get install -y libsdl2-dev zlib1g-dev libpng12-dev libvorbis-dev libcups2-dev libssl-dev -sudo: required -dist: trusty -script: ./make-makefile.sh -t $TARGET && make -j2 \ No newline at end of file diff --git a/common.mk b/common.mk index dc17b56..04ca69f 100644 --- a/common.mk +++ b/common.mk @@ -1,4 +1,4 @@ -.PHONY: all clean distclean install +.PHONY: all clean distclean install bin-archive SHELL := /bin/bash @@ -12,8 +12,13 @@ CC := $(CHOST)-gcc export CC CXX := $(CHOST)-g++ export CXX +CPP := $(CHOST)-cpp +export CPP +CXXCPP := $(CHOST)-cpp +export CXXCPP AR := $(CHOST)-ar export AR +LIBS := SOURCE_DIR := $(abspath .) HEADERS := $(wildcard $(SOURCE_DIR)/include/*.h) HEADERS += $(wildcard $(SOURCE_DIR)/include/*/*.h) @@ -32,7 +37,7 @@ OPENSSL_LIB_DIR := $(OPENSSL_BUILD_DIR) HEADERS += $(OPENSSL_BUILD_MAKEFILE) LIBCRYPTO := $(OPENSSL_BUILD_DIR)/$(LIBCRYPTO_NAME) LIBSSL := $(OPENSSL_BUILD_DIR)/$(LIBSSL_NAME) -LDFLAGS += $(LIBSSL) $(LIBCRYPTO) +LIBS += $(LIBSSL) $(LIBCRYPTO) LIBPNG_BUILD_DIR := $(BUILD_DIR)/libpng LIBPNG_BUILD_AUTOGEN := $(LIBPNG_BUILD_DIR)/autogen.sh LIBPNG_BUILD_CONFIGURE := $(LIBPNG_BUILD_DIR)/configure @@ -42,7 +47,7 @@ LIBPNG_LIB_DIR := $(LIBPNG_BUILD_DIR) HEADERS += $(LIBPNG_BUILD_MAKEFILE) LIBPNG_LA := $(LIBPNG_BUILD_DIR)/.libs/libpng16.la LIBPNG := $(LIBPNG_BUILD_DIR)/libpng16.a -LDFLAGS += $(LIBPNG) +LIBS += $(LIBPNG) ZLIB_BUILD_DIR := $(BUILD_DIR)/zlib ZLIB_BUILD_CONFIGURE := $(ZLIB_BUILD_DIR)/configure ZLIB_BUILD_MAKEFILE := $(ZLIB_BUILD_DIR)/Makefile @@ -50,7 +55,7 @@ ZLIB_INCLUDE_DIR := $(ZLIB_BUILD_DIR) ZLIB_LIB_DIR := $(ZLIB_BUILD_DIR) HEADERS += $(ZLIB_BUILD_MAKEFILE) LIBZ := $(ZLIB_BUILD_DIR)/libz.a -LDFLAGS += $(LIBZ) +LIBS += $(LIBZ) VORBIS_BUILD_DIR := $(BUILD_DIR)/vorbis VORBIS_BUILD_AUTOGEN := $(VORBIS_BUILD_DIR)/autogen.sh VORBIS_BUILD_MAKEFILE := $(VORBIS_BUILD_DIR)/Makefile @@ -60,7 +65,7 @@ HEADERS += $(VORBIS_BUILD_MAKEFILE) LIBVORBISFILE_LA := $(VORBIS_BUILD_DIR)/lib/.libs/libvorbisfile.la LIBVORBIS := $(VORBIS_BUILD_DIR)/libvorbis.a LIBVORBISFILE := $(VORBIS_BUILD_DIR)/libvorbisfile.a -LDFLAGS += $(LIBVORBISFILE) $(LIBVORBIS) +LIBS += $(LIBVORBISFILE) $(LIBVORBIS) OGG_BUILD_DIR := $(BUILD_DIR)/ogg OGG_BUILD_AUTOGEN := $(OGG_BUILD_DIR)/autogen.sh OGG_BUILD_MAKEFILE := $(OGG_BUILD_DIR)/Makefile @@ -69,7 +74,7 @@ OGG_LIB_DIR := $(OGG_BUILD_DIR) HEADERS += $(OGG_BUILD_MAKEFILE) LIBOGG_LA := $(OGG_BUILD_DIR)/src/.libs/libogg.la LIBOGG := $(OGG_BUILD_DIR)/libogg.a -LDFLAGS += $(LIBOGG) +LIBS += $(LIBOGG) SDL_BUILD_DIR := $(BUILD_DIR)/SDL SDL_BUILD_CONFIGURE := $(SDL_BUILD_DIR)/configure SDL_BUILD_MAKEFILE := $(SDL_BUILD_DIR)/Makefile @@ -79,7 +84,7 @@ HEADERS += $(SDL_BUILD_MAKEFILE) LIBSDL2_LA := $(SDL_BUILD_DIR)/build/.libs/libSDL2.la LIBSDL2 := $(SDL_BUILD_DIR)/build/libSDL2.a LIBSDL2MAIN := $(SDL_BUILD_DIR)/build/libSDL2main.a -LDFLAGS += $(LIBSDL2) -Wl,--whole-archive $(LIBSDL2MAIN) -Wl,--no-whole-archive +LIBS += $(LIBSDL2) -Wl,--whole-archive $(LIBSDL2MAIN) -Wl,--no-whole-archive PROGRAM_NAME := voxels$(EXEEXT) PROGRAM := $(BUILD_DIR)/$(PROGRAM_NAME) CPP_SOURCES := $(wildcard $(SOURCE_DIR)/src/*.cpp) @@ -196,7 +201,7 @@ $(SDL_BUILD_CONFIGURE): ; && [ -x $(SDL_BUILD_CONFIGURE) ] $(SDL_BUILD_MAKEFILE): $(SDL_BUILD_CONFIGURE) - cd $(SDL_BUILD_DIR) && ./configure --disable-dependency-tracking --enable-libc --disable-shared --disable-render-d3d --host $(CHOST) + cd $(SDL_BUILD_DIR) && ./configure --disable-dependency-tracking --enable-libc --disable-sndio --disable-shared --disable-render-d3d --host $(CHOST) $(LIBSDL2_LA): $(SDL_BUILD_MAKEFILE) cd $(SDL_BUILD_DIR) && $(MAKE) @@ -222,10 +227,9 @@ $(BUILD_DIR)/%.o : $(SOURCE_DIR)/%.cpp $(HEADERS) mkdir -p $(dir $@) && $(CXX) $(CPPFLAGS) $(CFLAGS) $(CXXFLAGS) -c -o $@ $< LDFLAGS += -static-libgcc -static-libstdc++ -LDFLAGS += $(DEFERRED_LDFLAGS) $(PROGRAM) : $(OBJECTS) $(LIBSDL2) $(LIBSDL2MAIN) $(LIBPNG) $(LIBOGG) $(LIBVORBISFILE) $(LIBVORBIS) $(LIBCRYPTO) $(LIBSSL) $(LIBZ) - $(CXX) -o $(PROGRAM) $(OBJECTS) $(LDFLAGS) + $(CXX) -o $(PROGRAM) $(OBJECTS) $(LDFLAGS) $(LIBS) $(DEFERRED_LDFLAGS) install: all @@ -233,4 +237,13 @@ clean: -rm -rf $(OBJECTS) $(PROGRAM) distclean: clean - -rm -rf $(BUILD_DIR) \ No newline at end of file + -rm -rf $(BUILD_DIR) + +ARCHIVE_NAME := voxels$(ARCHIVE_EXTENSION) + +bin-archive: all + mkdir -p $(BUILD_DIR)/voxels-0.7 \ + && cp -rt $(BUILD_DIR)/voxels-0.7 $(PROGRAM) $(SOURCE_DIR)/res $(SOURCE_DIR)/LICENSE $(SOURCE_DIR)/README.md \ + && cd $(BUILD_DIR) \ + && { rm -f $(ARCHIVE_NAME) || true; } \ + && $(ARCHIVE_COMMAND) $(ARCHIVE_NAME) voxels-0.7 diff --git a/linux-x86_64-cross-x86_64-w64-mingw32.mk b/linux-x86_64-cross-x86_64-w64-mingw32.mk index de931f9..245333e 100644 --- a/linux-x86_64-cross-x86_64-w64-mingw32.mk +++ b/linux-x86_64-cross-x86_64-w64-mingw32.mk @@ -13,5 +13,7 @@ CFLAGS := $(CFLAGS) CFLAGS += -pthread -mwin32 -mwindows DEFERRED_LDFLAGS := -static -pthread -lopengl32 -mwin32 -mwindows -lws2_32 -lgdi32 -lcrypt32 -lole32 DEFERRED_LDFLAGS += -limm32 -lversion -loleaut32 -lwinmm +ARCHIVE_EXTENSION := .zip +ARCHIVE_COMMAND := zip -r include common.mk diff --git a/linux-x86_64.mk b/linux-x86_64.mk index 83a476e..2af7b70 100644 --- a/linux-x86_64.mk +++ b/linux-x86_64.mk @@ -11,6 +11,8 @@ CFLAGS := -O2 -DNDEBUG endif CFLAGS := $(CFLAGS) CFLAGS += -pthread -DEFERRED_LDFLAGS := -pthread -lGL -ldl +DEFERRED_LDFLAGS := -pthread -lGL -ldl -lrt +ARCHIVE_EXTENSION := .txz +ARCHIVE_COMMAND := tar -cvaf include common.mk \ No newline at end of file