From a8969f8a968c2efec1bee44f3185755ef1fae5d6 Mon Sep 17 00:00:00 2001 From: Quentin Quadrat Date: Mon, 1 Jul 2024 22:44:15 +0200 Subject: [PATCH] Use MyMakefile-v2 --- .makefile | 2 +- Makefile | 107 ++++++++--------------------- Makefile.common | 4 ++ VERSION.txt | 1 - doc/demos/Unzipper/Makefile | 51 ++++---------- external/compile-external-libs.sh | 2 - external/download-external-libs.sh | 2 - 7 files changed, 46 insertions(+), 123 deletions(-) create mode 100644 Makefile.common delete mode 100644 VERSION.txt diff --git a/.makefile b/.makefile index 9f5eb26..2b90942 160000 --- a/.makefile +++ b/.makefile @@ -1 +1 @@ -Subproject commit 9f5eb268d18c518c30d094b937b1a4274142cd1b +Subproject commit 2b909421404f57c6fe7850a6aad00be62acf1ee3 diff --git a/Makefile b/Makefile index 5179d4c..6636b5a 100644 --- a/Makefile +++ b/Makefile @@ -1,103 +1,54 @@ -################################################### -# Project definition -# -PROJECT = Zipper -TARGET = $(PROJECT) -DESCRIPTION = C++ wrapper around minizip compression library -STANDARD = --std=c++11 -BUILD_TYPE = release - -################################################### -# Documentation -# -LOGO = logo.png - ################################################### # Location of the project directory and Makefiles # P := . M := $(P)/.makefile -include $(M)/Makefile.header - -################################################### -# Inform Makefile where to find *.cpp and *.o files -# -VPATH += $(P)/src $(P)/src/utils $(THIRDPART) ################################################### -# Inform Makefile where to find header files -# -INCLUDES += -I. -I$(P)/include -I$(P)/src - -################################################### -# Compilation +# Project definition # -#CXXFLAGS += -Wno-undef +include $(P)/Makefile.common +TARGET_NAME := $(PROJECT_NAME) +TARGET_DESCRIPTION := An open source implementation of the SimCity 2013 simulation engine GlassBox +include $(M)/project/Makefile ################################################### -# Project defines. +# Compile shared and static libraries # -DEFINES += -DHAVE_AES -ifeq ($(ARCHI),Windows) -DEFINES += -DUSE_WINDOWS +LIB_FILES := $(call rwildcard,src,*.cpp) +INCLUDES := $(P)/include $(P)/src $(P) +VPATH := $(P)/src $(P)/src/utils $(THIRDPART_DIR) +ifeq ($(OS),Windows) + LIB_FILES += src/utils/dirent.c + DEFINES += -DUSE_WINDOWS -DHAVE_AES else -DEFINES += -UUSE_WINDOWS + DEFINES += -UUSE_WINDOWS -DHAVE_AES endif +THIRDPART_LIBS := $(abspath $(THIRDPART_DIR)/minizip/build/libminizip.a) +THIRDPART_LIBS += $(abspath $(THIRDPART_DIR)/minizip/build/libaes.a) +THIRDPART_LIBS += $(abspath $(THIRDPART_DIR)/zlib-ng/build/libz.a) ################################################### -# Compiled files +# Documentation # -ifeq ($(ARCHI),Windows) -LIB_OBJS += dirent.o -endif -LIB_OBJS += Timestamp.o Path.o Zipper.o Unzipper.o +PATH_PROJECT_LOGO = doc/logo.png ################################################### -# Libraries. +# Generic Makefile rules # -PKG_LIBS += -LINKER_FLAGS += -THIRDPART_LIBS += \ - $(abspath $(THIRDPART)/minizip/build/libminizip.a) \ - $(abspath $(THIRDPART)/minizip/build/libaes.a) \ - $(abspath $(THIRDPART)/zlib-ng/build/libz.a) +include $(M)/rules/Makefile ################################################### -# Compile static and shared libraries -all: $(STATIC_LIB_TARGET) $(SHARED_LIB_TARGET) $(PKG_FILE) +# Extra rules +# +all:: demos -################################################### -# Compile the demo as standalone application. .PHONY: demos -demos: | $(STATIC_LIB_TARGET) $(SHARED_LIB_TARGET) - @$(call print-from,"Compiling demos",$(PROJECT),unzip) - $(MAKE) -C doc/demos/Unzipper all +demos: + $(Q)$(MAKE) --no-print-directory --directory=doc/demos/Unzipper all -################################################### -# Compile and launch unit tests and generate the code coverage html report. -.PHONY: unit-tests -.PHONY: check -unit-tests check: - @$(call print-simple,"Compiling unit tests") - @$(MAKE) -C tests coverage - -################################################### -# Install project. You need to be root. -.PHONY: install -install: $(STATIC_LIB_TARGET) $(SHARED_LIB_TARGET) $(PKG_FILE) - @$(call INSTALL_DOCUMENTATION) - @$(call INSTALL_PROJECT_LIBRARIES) - @$(call INSTALL_PROJECT_HEADERS) +clean:: + $(Q)$(MAKE) --no-print-directory --directory=doc/demos/Unzipper clean -################################################### -# Clean the whole project. -.PHONY: veryclean -veryclean: clean - @rm -fr cov-int $(PROJECT).tgz *.log foo 2> /dev/null - @(cd tests && $(MAKE) -s clean) - @$(call print-simple,"Cleaning","$(THIRDPART)") - @rm -fr $(THIRDPART)/*/ doc/html 2> /dev/null - -################################################### -# Sharable informations between all Makefiles -include $(M)/Makefile.footer +install:: + $(Q)$(MAKE) --no-print-directory --directory=doc/demos/Unzipper install \ No newline at end of file diff --git a/Makefile.common b/Makefile.common new file mode 100644 index 0000000..f8841ce --- /dev/null +++ b/Makefile.common @@ -0,0 +1,4 @@ +PROJECT_NAME := zipper +PROJECT_VERSION := 2.1.0 +COMPILATION_MODE := release +CXX_STANDARD := --std=c++11 \ No newline at end of file diff --git a/VERSION.txt b/VERSION.txt deleted file mode 100644 index 7ec1d6d..0000000 --- a/VERSION.txt +++ /dev/null @@ -1 +0,0 @@ -2.1.0 diff --git a/doc/demos/Unzipper/Makefile b/doc/demos/Unzipper/Makefile index 2c95efc..2296815 100644 --- a/doc/demos/Unzipper/Makefile +++ b/doc/demos/Unzipper/Makefile @@ -1,53 +1,26 @@ -################################################### -# Project definition -# -PROJECT = Zipper -TARGET = demo_unzip -DESCRIPTION = Demo for unzipping a zip -STANDARD = --std=c++11 -BUILD_TYPE = release - ################################################### # Location of the project directory and Makefiles # P := ../../.. M := $(P)/.makefile -include $(M)/Makefile.header - -################################################### -# Inform Makefile where to find *.cpp and *.o files -# -VPATH += $(P) src - -################################################### -# Inform Makefile where to find header files -# -INCLUDES += -I$(P)/include -Isrc ################################################### -# Compilation -# -CXXFLAGS += - -################################################### -# Project defines. +# Project definition # -DEFINES += +include $(P)/Makefile.common +TARGET_NAME := unzipper-demo +TARGET_DESCRIPTION := A demo for unzipping using $(PROJECT_NAME) +include $(M)/project/Makefile ################################################### -# Compile the demo as standalone application. +# Compile the standalone application # -OBJS += demo_unzip.o +SRC_FILES := $(call rwildcard,src,*.cpp) +INCLUDES := $(P)/include src +VPATH := $(P)/demo +INTERNAL_LIBS := $(call internal-lib,$(PROJECT_NAME)) ################################################### -# Libraries: link against our newly compiled lib +# Generic Makefile rules # -THIRDPART_LIBS += $(abspath $(P)/$(BUILD)/libzipper.a) - -################################################### -# Compile static and shared libraries -all: $(TARGET) - -################################################### -# Sharable informations between all Makefiles -include $(M)/Makefile.footer +include $(M)/rules/Makefile diff --git a/external/compile-external-libs.sh b/external/compile-external-libs.sh index 65d33a7..d0805e0 100755 --- a/external/compile-external-libs.sh +++ b/external/compile-external-libs.sh @@ -21,8 +21,6 @@ ### find them when you'll start your application. ############################################################################### -source ../.makefile/compile-external-libs.sh - ### Library zlib-ng print-compile zlib-ng if [ -e zlib-ng ]; diff --git a/external/download-external-libs.sh b/external/download-external-libs.sh index bb2c168..ef363b0 100755 --- a/external/download-external-libs.sh +++ b/external/download-external-libs.sh @@ -5,8 +5,6 @@ ### It replaces git submodules that I dislike. ############################################################################### -source ../.makefile/download-external-libs.sh - ### zlib replacement with optimizations for "next generation" systems. ### License: zlib cloning zlib-ng/zlib-ng