From 7d26eaabe763b24611c7ebd4715637b0be17a456 Mon Sep 17 00:00:00 2001 From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz> Date: Tue, 20 Jun 2017 09:21:46 +0200 Subject: [PATCH] unify all makefiles --- aaccess2/makefile | 175 +------------ aarbology2/makefile | 175 +------------ acast2/makefile | 175 +------------ acompaction2/makefile | 175 +------------ acompare2/makefile | 175 +------------ aconversions2/makefile | 175 +------------ aconvert2/makefile | 175 +------------ aderivation2/makefile | 175 +------------ adeterminize2/makefile | 175 +------------ aecho2/makefile | 175 +------------ aepsilon2/makefile | 175 +------------ agenerate2/makefile | 175 +------------ aintegral2/makefile | 175 +------------ aintrospection2/makefile | 175 +------------ alangop2/makefile | 175 +------------ alib2algo/makefile | 240 +----------------- alib2algo_experimental/makefile | 240 +----------------- alib2common/makefile | 240 +----------------- .../measurements/MeasurementsTest.cpp | 8 +- alib2data/makefile | 240 +----------------- alib2data_experimental/makefile | 240 +----------------- alib2elgo/makefile | 240 +----------------- alib2measurepp/makefile | 240 +----------------- alib2raw/makefile | 240 +----------------- alib2std/makefile | 240 +----------------- alib2str/makefile | 240 +----------------- alib2str_experimental/makefile | 240 +----------------- ameasure2/makefile | 175 +------------ ameasurep2/makefile | 175 +------------ aminimize2/makefile | 175 +------------ anormalize2/makefile | 175 +------------ aquery2/makefile | 175 +------------ arand2/makefile | 175 +------------ araw2/makefile | 175 +------------ arename2/makefile | 175 +------------ areverse2/makefile | 175 +------------ arun2/makefile | 175 +------------ astat2/makefile | 175 +------------ astringology2/makefile | 175 +------------ atrim2/makefile | 175 +------------ makefile-binary | 171 +++++++++++++ makefile-library | 236 +++++++++++++++++ tniceprint/makefile | 175 +------------ 43 files changed, 494 insertions(+), 7636 deletions(-) create mode 100644 makefile-binary create mode 100644 makefile-library diff --git a/aaccess2/makefile b/aaccess2/makefile index 4064fd0131..bd9fb6f7bc 100644 --- a/aaccess2/makefile +++ b/aaccess2/makefile @@ -1,174 +1,3 @@ -SHELL:=/bin/bash - --include ../build.conf -include makefile.conf - -LTO_PARAM:= -ifeq ($(USE_LTO),1) -LTO_PARAM:= -flto -endif - -define NEW_LINE - - -endef - -export NEW_LINE - -CXX_FLAGS := -Wall -pedantic -Wextra -Werror -Wshadow -Wpointer-arith -Wcast-qual -Wdelete-non-virtual-dtor -Wredundant-decls - -LDFLAGS_DEBUG:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-debug, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) -Wl,-rpath,. - -LDFLAGS_RELEASE:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-release, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) $(LTO_PARAM) -Wl,-rpath,. - -OBJECTS_DEBUG:=$(patsubst src/%.cpp,obj-debug/%.o, $(shell find src/ -name *cpp)) - -OBJECTS_RELEASE:=$(patsubst src/%.cpp,obj-release/%.o, $(shell find src/ -name *cpp)) - -.PHONY: all build-debug clean-debug doc - -all: - @echo "What to do master?" - -FORCE: - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# make subdir makefile - -%/makefile: makefile makefile.conf - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - echo "\ - SHELL:=/bin/bash$${NEW_LINE}\ - SRCDIR:=$${NEW_LINE}\ - $${NEW_LINE}\ - define NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - $${NEW_LINE}\ - endef$${NEW_LINE}\ - $${NEW_LINE}\ - export NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - CXXFLAGS:= -pipe -std=c++11 \$$(CXX_OTHER_FLAGS) -c $(CXX_FLAGS) -fPIC \$$(addprefix -I, \$$(realpath $(INCLUDE_PATHS)))$${NEW_LINE}\ - $${NEW_LINE}\ - SOURCES:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -type f -name \"*.cpp\")$${NEW_LINE}\ - DEPENDENCIES:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d, \$$(SOURCES))$${NEW_LINE}\ - OBJECTS:= \$$(patsubst %.d, %.o, \$$(DEPENDENCIES))$${NEW_LINE}\ - SOURCES_DIRS:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -mindepth 1 -type d)$${NEW_LINE}\ - OBJECTS_DIRS:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%, %/, \$$(SOURCES_DIRS))$${NEW_LINE}\ - OBJECTS_DIRS_MAKEFILES:= \$$(patsubst %, %makefile, \$$(OBJECTS_DIRS))$${NEW_LINE}\ - $${NEW_LINE}\ - .PHONY: all$${NEW_LINE}\ - .PRECIOUS: \$$(DEPENDECIES) \$$(OBJECTS_DIRS_MAKEFILES)$${NEW_LINE}\ - $${NEW_LINE}\ - all: \$$(OBJECTS_DIRS) \$$(OBJECTS)$${NEW_LINE}\ - $${NEW_LINE}\ - %.d: makefile$${NEW_LINE}\ - @echo \"\\$${NEW_LINE}\ - \$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\") = \\$$\$$(shell (\\$$\$$(CXX) -M \\$$\$$(CXXFLAGS) \$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) 2>/dev/null || echo \\\"\$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) FORCE\\\") | sed \\\"s/.*://g;s/\\\\\\\\\\\\\\\\//g\\\")\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \$$(patsubst %.d,%.o, \$$@): \\$$\$$(\$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\")) makefile\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \\$$\$$(CXX) \\$$\$$(CXXFLAGS) \\$$\$$< -o \$$(patsubst %.d,%.o, \$$@)\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \" > \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/makefile: makefile$${NEW_LINE}\ - mkdir -p \$$(dir \$$@)$${NEW_LINE}\ - cp makefile \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/: FORCE | %/makefile$${NEW_LINE}\ - @accesstime=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - \$$(MAKE) -C \$$@ SRCDIR=\$$(SRCDIR)\$$(notdir \$$(patsubst %/, %, \$$@))/ OBJECTS_BASE_DIR=\$$(OBJECTS_BASE_DIR) SOURCES_BASE_DIR=\$$(SOURCES_BASE_DIR) CXX_OTHER_FLAGS=\"\$$(CXX_OTHER_FLAGS)\" && \\$${NEW_LINE}\ - accesstime2=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - if [ "\$$\$$accesstime" -ne "\$$\$$accesstime2" ]; then \\$${NEW_LINE}\ - touch .; \\$${NEW_LINE}\ - fi$${NEW_LINE}\ - $${NEW_LINE}\ - FORCE:$${NEW_LINE}\ - $${NEW_LINE}\ - -include \$$(DEPENDENCIES)" > $@ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# final lib/bin construction - -bin-debug/$(EXECUTABLE): obj-debug/ $(OBJECTS_DEBUG) - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG) - -bin-release/$(EXECUTABLE): obj-release/ $(OBJECTS_RELEASE) - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# subdir make calls - -obj-debug/: FORCE | obj-debug/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-debug) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-g -Og -DDEBUG" - -obj-release/: FORCE | obj-release/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-release) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-O3 -DNDEBUG -DRELEASE $(LTO_PARAM)" - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# objects dependencies - -$(OBJECTS_DEBUG): obj-debug/ - -$(OBJECTS_RELEASE): obj-release/ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# standalone main targets - -build-code-debug: bin-debug/$(EXECUTABLE) - -build-code-release: bin-release/$(EXECUTABLE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# do all main targets - -debug: - $(MAKE) build-code-debug - -release: - $(MAKE) build-code-release - -clean: clean-debug clean-release - $(RM) -r doc - -clean-debug: - if [ -L obj-debug ]; then\ - $(RM) -r `readlink obj-debug`;\ - fi - if [ -L bin-debug ]; then\ - $(RM) -r `readlink bin-debug`;\ - fi - $(RM) -r *.o *.d bin-debug obj-debug - -clean-release: - if [ -L obj-release ]; then\ - $(RM) -r `readlink obj-release`;\ - fi - if [ -L lib-release ]; then\ - $(RM) -r `readlink lib-release`;\ - fi - $(RM) -r *.o *.d bin-release obj-release - -doc: - doxygen +-include ../build.conf +-include ../makefile-binary diff --git a/aarbology2/makefile b/aarbology2/makefile index 4064fd0131..bd9fb6f7bc 100644 --- a/aarbology2/makefile +++ b/aarbology2/makefile @@ -1,174 +1,3 @@ -SHELL:=/bin/bash - --include ../build.conf -include makefile.conf - -LTO_PARAM:= -ifeq ($(USE_LTO),1) -LTO_PARAM:= -flto -endif - -define NEW_LINE - - -endef - -export NEW_LINE - -CXX_FLAGS := -Wall -pedantic -Wextra -Werror -Wshadow -Wpointer-arith -Wcast-qual -Wdelete-non-virtual-dtor -Wredundant-decls - -LDFLAGS_DEBUG:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-debug, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) -Wl,-rpath,. - -LDFLAGS_RELEASE:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-release, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) $(LTO_PARAM) -Wl,-rpath,. - -OBJECTS_DEBUG:=$(patsubst src/%.cpp,obj-debug/%.o, $(shell find src/ -name *cpp)) - -OBJECTS_RELEASE:=$(patsubst src/%.cpp,obj-release/%.o, $(shell find src/ -name *cpp)) - -.PHONY: all build-debug clean-debug doc - -all: - @echo "What to do master?" - -FORCE: - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# make subdir makefile - -%/makefile: makefile makefile.conf - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - echo "\ - SHELL:=/bin/bash$${NEW_LINE}\ - SRCDIR:=$${NEW_LINE}\ - $${NEW_LINE}\ - define NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - $${NEW_LINE}\ - endef$${NEW_LINE}\ - $${NEW_LINE}\ - export NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - CXXFLAGS:= -pipe -std=c++11 \$$(CXX_OTHER_FLAGS) -c $(CXX_FLAGS) -fPIC \$$(addprefix -I, \$$(realpath $(INCLUDE_PATHS)))$${NEW_LINE}\ - $${NEW_LINE}\ - SOURCES:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -type f -name \"*.cpp\")$${NEW_LINE}\ - DEPENDENCIES:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d, \$$(SOURCES))$${NEW_LINE}\ - OBJECTS:= \$$(patsubst %.d, %.o, \$$(DEPENDENCIES))$${NEW_LINE}\ - SOURCES_DIRS:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -mindepth 1 -type d)$${NEW_LINE}\ - OBJECTS_DIRS:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%, %/, \$$(SOURCES_DIRS))$${NEW_LINE}\ - OBJECTS_DIRS_MAKEFILES:= \$$(patsubst %, %makefile, \$$(OBJECTS_DIRS))$${NEW_LINE}\ - $${NEW_LINE}\ - .PHONY: all$${NEW_LINE}\ - .PRECIOUS: \$$(DEPENDECIES) \$$(OBJECTS_DIRS_MAKEFILES)$${NEW_LINE}\ - $${NEW_LINE}\ - all: \$$(OBJECTS_DIRS) \$$(OBJECTS)$${NEW_LINE}\ - $${NEW_LINE}\ - %.d: makefile$${NEW_LINE}\ - @echo \"\\$${NEW_LINE}\ - \$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\") = \\$$\$$(shell (\\$$\$$(CXX) -M \\$$\$$(CXXFLAGS) \$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) 2>/dev/null || echo \\\"\$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) FORCE\\\") | sed \\\"s/.*://g;s/\\\\\\\\\\\\\\\\//g\\\")\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \$$(patsubst %.d,%.o, \$$@): \\$$\$$(\$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\")) makefile\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \\$$\$$(CXX) \\$$\$$(CXXFLAGS) \\$$\$$< -o \$$(patsubst %.d,%.o, \$$@)\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \" > \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/makefile: makefile$${NEW_LINE}\ - mkdir -p \$$(dir \$$@)$${NEW_LINE}\ - cp makefile \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/: FORCE | %/makefile$${NEW_LINE}\ - @accesstime=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - \$$(MAKE) -C \$$@ SRCDIR=\$$(SRCDIR)\$$(notdir \$$(patsubst %/, %, \$$@))/ OBJECTS_BASE_DIR=\$$(OBJECTS_BASE_DIR) SOURCES_BASE_DIR=\$$(SOURCES_BASE_DIR) CXX_OTHER_FLAGS=\"\$$(CXX_OTHER_FLAGS)\" && \\$${NEW_LINE}\ - accesstime2=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - if [ "\$$\$$accesstime" -ne "\$$\$$accesstime2" ]; then \\$${NEW_LINE}\ - touch .; \\$${NEW_LINE}\ - fi$${NEW_LINE}\ - $${NEW_LINE}\ - FORCE:$${NEW_LINE}\ - $${NEW_LINE}\ - -include \$$(DEPENDENCIES)" > $@ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# final lib/bin construction - -bin-debug/$(EXECUTABLE): obj-debug/ $(OBJECTS_DEBUG) - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG) - -bin-release/$(EXECUTABLE): obj-release/ $(OBJECTS_RELEASE) - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# subdir make calls - -obj-debug/: FORCE | obj-debug/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-debug) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-g -Og -DDEBUG" - -obj-release/: FORCE | obj-release/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-release) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-O3 -DNDEBUG -DRELEASE $(LTO_PARAM)" - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# objects dependencies - -$(OBJECTS_DEBUG): obj-debug/ - -$(OBJECTS_RELEASE): obj-release/ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# standalone main targets - -build-code-debug: bin-debug/$(EXECUTABLE) - -build-code-release: bin-release/$(EXECUTABLE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# do all main targets - -debug: - $(MAKE) build-code-debug - -release: - $(MAKE) build-code-release - -clean: clean-debug clean-release - $(RM) -r doc - -clean-debug: - if [ -L obj-debug ]; then\ - $(RM) -r `readlink obj-debug`;\ - fi - if [ -L bin-debug ]; then\ - $(RM) -r `readlink bin-debug`;\ - fi - $(RM) -r *.o *.d bin-debug obj-debug - -clean-release: - if [ -L obj-release ]; then\ - $(RM) -r `readlink obj-release`;\ - fi - if [ -L lib-release ]; then\ - $(RM) -r `readlink lib-release`;\ - fi - $(RM) -r *.o *.d bin-release obj-release - -doc: - doxygen +-include ../build.conf +-include ../makefile-binary diff --git a/acast2/makefile b/acast2/makefile index 4064fd0131..bd9fb6f7bc 100644 --- a/acast2/makefile +++ b/acast2/makefile @@ -1,174 +1,3 @@ -SHELL:=/bin/bash - --include ../build.conf -include makefile.conf - -LTO_PARAM:= -ifeq ($(USE_LTO),1) -LTO_PARAM:= -flto -endif - -define NEW_LINE - - -endef - -export NEW_LINE - -CXX_FLAGS := -Wall -pedantic -Wextra -Werror -Wshadow -Wpointer-arith -Wcast-qual -Wdelete-non-virtual-dtor -Wredundant-decls - -LDFLAGS_DEBUG:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-debug, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) -Wl,-rpath,. - -LDFLAGS_RELEASE:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-release, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) $(LTO_PARAM) -Wl,-rpath,. - -OBJECTS_DEBUG:=$(patsubst src/%.cpp,obj-debug/%.o, $(shell find src/ -name *cpp)) - -OBJECTS_RELEASE:=$(patsubst src/%.cpp,obj-release/%.o, $(shell find src/ -name *cpp)) - -.PHONY: all build-debug clean-debug doc - -all: - @echo "What to do master?" - -FORCE: - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# make subdir makefile - -%/makefile: makefile makefile.conf - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - echo "\ - SHELL:=/bin/bash$${NEW_LINE}\ - SRCDIR:=$${NEW_LINE}\ - $${NEW_LINE}\ - define NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - $${NEW_LINE}\ - endef$${NEW_LINE}\ - $${NEW_LINE}\ - export NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - CXXFLAGS:= -pipe -std=c++11 \$$(CXX_OTHER_FLAGS) -c $(CXX_FLAGS) -fPIC \$$(addprefix -I, \$$(realpath $(INCLUDE_PATHS)))$${NEW_LINE}\ - $${NEW_LINE}\ - SOURCES:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -type f -name \"*.cpp\")$${NEW_LINE}\ - DEPENDENCIES:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d, \$$(SOURCES))$${NEW_LINE}\ - OBJECTS:= \$$(patsubst %.d, %.o, \$$(DEPENDENCIES))$${NEW_LINE}\ - SOURCES_DIRS:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -mindepth 1 -type d)$${NEW_LINE}\ - OBJECTS_DIRS:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%, %/, \$$(SOURCES_DIRS))$${NEW_LINE}\ - OBJECTS_DIRS_MAKEFILES:= \$$(patsubst %, %makefile, \$$(OBJECTS_DIRS))$${NEW_LINE}\ - $${NEW_LINE}\ - .PHONY: all$${NEW_LINE}\ - .PRECIOUS: \$$(DEPENDECIES) \$$(OBJECTS_DIRS_MAKEFILES)$${NEW_LINE}\ - $${NEW_LINE}\ - all: \$$(OBJECTS_DIRS) \$$(OBJECTS)$${NEW_LINE}\ - $${NEW_LINE}\ - %.d: makefile$${NEW_LINE}\ - @echo \"\\$${NEW_LINE}\ - \$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\") = \\$$\$$(shell (\\$$\$$(CXX) -M \\$$\$$(CXXFLAGS) \$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) 2>/dev/null || echo \\\"\$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) FORCE\\\") | sed \\\"s/.*://g;s/\\\\\\\\\\\\\\\\//g\\\")\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \$$(patsubst %.d,%.o, \$$@): \\$$\$$(\$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\")) makefile\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \\$$\$$(CXX) \\$$\$$(CXXFLAGS) \\$$\$$< -o \$$(patsubst %.d,%.o, \$$@)\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \" > \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/makefile: makefile$${NEW_LINE}\ - mkdir -p \$$(dir \$$@)$${NEW_LINE}\ - cp makefile \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/: FORCE | %/makefile$${NEW_LINE}\ - @accesstime=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - \$$(MAKE) -C \$$@ SRCDIR=\$$(SRCDIR)\$$(notdir \$$(patsubst %/, %, \$$@))/ OBJECTS_BASE_DIR=\$$(OBJECTS_BASE_DIR) SOURCES_BASE_DIR=\$$(SOURCES_BASE_DIR) CXX_OTHER_FLAGS=\"\$$(CXX_OTHER_FLAGS)\" && \\$${NEW_LINE}\ - accesstime2=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - if [ "\$$\$$accesstime" -ne "\$$\$$accesstime2" ]; then \\$${NEW_LINE}\ - touch .; \\$${NEW_LINE}\ - fi$${NEW_LINE}\ - $${NEW_LINE}\ - FORCE:$${NEW_LINE}\ - $${NEW_LINE}\ - -include \$$(DEPENDENCIES)" > $@ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# final lib/bin construction - -bin-debug/$(EXECUTABLE): obj-debug/ $(OBJECTS_DEBUG) - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG) - -bin-release/$(EXECUTABLE): obj-release/ $(OBJECTS_RELEASE) - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# subdir make calls - -obj-debug/: FORCE | obj-debug/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-debug) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-g -Og -DDEBUG" - -obj-release/: FORCE | obj-release/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-release) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-O3 -DNDEBUG -DRELEASE $(LTO_PARAM)" - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# objects dependencies - -$(OBJECTS_DEBUG): obj-debug/ - -$(OBJECTS_RELEASE): obj-release/ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# standalone main targets - -build-code-debug: bin-debug/$(EXECUTABLE) - -build-code-release: bin-release/$(EXECUTABLE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# do all main targets - -debug: - $(MAKE) build-code-debug - -release: - $(MAKE) build-code-release - -clean: clean-debug clean-release - $(RM) -r doc - -clean-debug: - if [ -L obj-debug ]; then\ - $(RM) -r `readlink obj-debug`;\ - fi - if [ -L bin-debug ]; then\ - $(RM) -r `readlink bin-debug`;\ - fi - $(RM) -r *.o *.d bin-debug obj-debug - -clean-release: - if [ -L obj-release ]; then\ - $(RM) -r `readlink obj-release`;\ - fi - if [ -L lib-release ]; then\ - $(RM) -r `readlink lib-release`;\ - fi - $(RM) -r *.o *.d bin-release obj-release - -doc: - doxygen +-include ../build.conf +-include ../makefile-binary diff --git a/acompaction2/makefile b/acompaction2/makefile index 4064fd0131..bd9fb6f7bc 100644 --- a/acompaction2/makefile +++ b/acompaction2/makefile @@ -1,174 +1,3 @@ -SHELL:=/bin/bash - --include ../build.conf -include makefile.conf - -LTO_PARAM:= -ifeq ($(USE_LTO),1) -LTO_PARAM:= -flto -endif - -define NEW_LINE - - -endef - -export NEW_LINE - -CXX_FLAGS := -Wall -pedantic -Wextra -Werror -Wshadow -Wpointer-arith -Wcast-qual -Wdelete-non-virtual-dtor -Wredundant-decls - -LDFLAGS_DEBUG:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-debug, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) -Wl,-rpath,. - -LDFLAGS_RELEASE:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-release, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) $(LTO_PARAM) -Wl,-rpath,. - -OBJECTS_DEBUG:=$(patsubst src/%.cpp,obj-debug/%.o, $(shell find src/ -name *cpp)) - -OBJECTS_RELEASE:=$(patsubst src/%.cpp,obj-release/%.o, $(shell find src/ -name *cpp)) - -.PHONY: all build-debug clean-debug doc - -all: - @echo "What to do master?" - -FORCE: - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# make subdir makefile - -%/makefile: makefile makefile.conf - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - echo "\ - SHELL:=/bin/bash$${NEW_LINE}\ - SRCDIR:=$${NEW_LINE}\ - $${NEW_LINE}\ - define NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - $${NEW_LINE}\ - endef$${NEW_LINE}\ - $${NEW_LINE}\ - export NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - CXXFLAGS:= -pipe -std=c++11 \$$(CXX_OTHER_FLAGS) -c $(CXX_FLAGS) -fPIC \$$(addprefix -I, \$$(realpath $(INCLUDE_PATHS)))$${NEW_LINE}\ - $${NEW_LINE}\ - SOURCES:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -type f -name \"*.cpp\")$${NEW_LINE}\ - DEPENDENCIES:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d, \$$(SOURCES))$${NEW_LINE}\ - OBJECTS:= \$$(patsubst %.d, %.o, \$$(DEPENDENCIES))$${NEW_LINE}\ - SOURCES_DIRS:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -mindepth 1 -type d)$${NEW_LINE}\ - OBJECTS_DIRS:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%, %/, \$$(SOURCES_DIRS))$${NEW_LINE}\ - OBJECTS_DIRS_MAKEFILES:= \$$(patsubst %, %makefile, \$$(OBJECTS_DIRS))$${NEW_LINE}\ - $${NEW_LINE}\ - .PHONY: all$${NEW_LINE}\ - .PRECIOUS: \$$(DEPENDECIES) \$$(OBJECTS_DIRS_MAKEFILES)$${NEW_LINE}\ - $${NEW_LINE}\ - all: \$$(OBJECTS_DIRS) \$$(OBJECTS)$${NEW_LINE}\ - $${NEW_LINE}\ - %.d: makefile$${NEW_LINE}\ - @echo \"\\$${NEW_LINE}\ - \$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\") = \\$$\$$(shell (\\$$\$$(CXX) -M \\$$\$$(CXXFLAGS) \$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) 2>/dev/null || echo \\\"\$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) FORCE\\\") | sed \\\"s/.*://g;s/\\\\\\\\\\\\\\\\//g\\\")\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \$$(patsubst %.d,%.o, \$$@): \\$$\$$(\$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\")) makefile\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \\$$\$$(CXX) \\$$\$$(CXXFLAGS) \\$$\$$< -o \$$(patsubst %.d,%.o, \$$@)\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \" > \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/makefile: makefile$${NEW_LINE}\ - mkdir -p \$$(dir \$$@)$${NEW_LINE}\ - cp makefile \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/: FORCE | %/makefile$${NEW_LINE}\ - @accesstime=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - \$$(MAKE) -C \$$@ SRCDIR=\$$(SRCDIR)\$$(notdir \$$(patsubst %/, %, \$$@))/ OBJECTS_BASE_DIR=\$$(OBJECTS_BASE_DIR) SOURCES_BASE_DIR=\$$(SOURCES_BASE_DIR) CXX_OTHER_FLAGS=\"\$$(CXX_OTHER_FLAGS)\" && \\$${NEW_LINE}\ - accesstime2=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - if [ "\$$\$$accesstime" -ne "\$$\$$accesstime2" ]; then \\$${NEW_LINE}\ - touch .; \\$${NEW_LINE}\ - fi$${NEW_LINE}\ - $${NEW_LINE}\ - FORCE:$${NEW_LINE}\ - $${NEW_LINE}\ - -include \$$(DEPENDENCIES)" > $@ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# final lib/bin construction - -bin-debug/$(EXECUTABLE): obj-debug/ $(OBJECTS_DEBUG) - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG) - -bin-release/$(EXECUTABLE): obj-release/ $(OBJECTS_RELEASE) - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# subdir make calls - -obj-debug/: FORCE | obj-debug/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-debug) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-g -Og -DDEBUG" - -obj-release/: FORCE | obj-release/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-release) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-O3 -DNDEBUG -DRELEASE $(LTO_PARAM)" - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# objects dependencies - -$(OBJECTS_DEBUG): obj-debug/ - -$(OBJECTS_RELEASE): obj-release/ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# standalone main targets - -build-code-debug: bin-debug/$(EXECUTABLE) - -build-code-release: bin-release/$(EXECUTABLE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# do all main targets - -debug: - $(MAKE) build-code-debug - -release: - $(MAKE) build-code-release - -clean: clean-debug clean-release - $(RM) -r doc - -clean-debug: - if [ -L obj-debug ]; then\ - $(RM) -r `readlink obj-debug`;\ - fi - if [ -L bin-debug ]; then\ - $(RM) -r `readlink bin-debug`;\ - fi - $(RM) -r *.o *.d bin-debug obj-debug - -clean-release: - if [ -L obj-release ]; then\ - $(RM) -r `readlink obj-release`;\ - fi - if [ -L lib-release ]; then\ - $(RM) -r `readlink lib-release`;\ - fi - $(RM) -r *.o *.d bin-release obj-release - -doc: - doxygen +-include ../build.conf +-include ../makefile-binary diff --git a/acompare2/makefile b/acompare2/makefile index 4064fd0131..bd9fb6f7bc 100644 --- a/acompare2/makefile +++ b/acompare2/makefile @@ -1,174 +1,3 @@ -SHELL:=/bin/bash - --include ../build.conf -include makefile.conf - -LTO_PARAM:= -ifeq ($(USE_LTO),1) -LTO_PARAM:= -flto -endif - -define NEW_LINE - - -endef - -export NEW_LINE - -CXX_FLAGS := -Wall -pedantic -Wextra -Werror -Wshadow -Wpointer-arith -Wcast-qual -Wdelete-non-virtual-dtor -Wredundant-decls - -LDFLAGS_DEBUG:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-debug, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) -Wl,-rpath,. - -LDFLAGS_RELEASE:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-release, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) $(LTO_PARAM) -Wl,-rpath,. - -OBJECTS_DEBUG:=$(patsubst src/%.cpp,obj-debug/%.o, $(shell find src/ -name *cpp)) - -OBJECTS_RELEASE:=$(patsubst src/%.cpp,obj-release/%.o, $(shell find src/ -name *cpp)) - -.PHONY: all build-debug clean-debug doc - -all: - @echo "What to do master?" - -FORCE: - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# make subdir makefile - -%/makefile: makefile makefile.conf - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - echo "\ - SHELL:=/bin/bash$${NEW_LINE}\ - SRCDIR:=$${NEW_LINE}\ - $${NEW_LINE}\ - define NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - $${NEW_LINE}\ - endef$${NEW_LINE}\ - $${NEW_LINE}\ - export NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - CXXFLAGS:= -pipe -std=c++11 \$$(CXX_OTHER_FLAGS) -c $(CXX_FLAGS) -fPIC \$$(addprefix -I, \$$(realpath $(INCLUDE_PATHS)))$${NEW_LINE}\ - $${NEW_LINE}\ - SOURCES:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -type f -name \"*.cpp\")$${NEW_LINE}\ - DEPENDENCIES:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d, \$$(SOURCES))$${NEW_LINE}\ - OBJECTS:= \$$(patsubst %.d, %.o, \$$(DEPENDENCIES))$${NEW_LINE}\ - SOURCES_DIRS:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -mindepth 1 -type d)$${NEW_LINE}\ - OBJECTS_DIRS:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%, %/, \$$(SOURCES_DIRS))$${NEW_LINE}\ - OBJECTS_DIRS_MAKEFILES:= \$$(patsubst %, %makefile, \$$(OBJECTS_DIRS))$${NEW_LINE}\ - $${NEW_LINE}\ - .PHONY: all$${NEW_LINE}\ - .PRECIOUS: \$$(DEPENDECIES) \$$(OBJECTS_DIRS_MAKEFILES)$${NEW_LINE}\ - $${NEW_LINE}\ - all: \$$(OBJECTS_DIRS) \$$(OBJECTS)$${NEW_LINE}\ - $${NEW_LINE}\ - %.d: makefile$${NEW_LINE}\ - @echo \"\\$${NEW_LINE}\ - \$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\") = \\$$\$$(shell (\\$$\$$(CXX) -M \\$$\$$(CXXFLAGS) \$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) 2>/dev/null || echo \\\"\$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) FORCE\\\") | sed \\\"s/.*://g;s/\\\\\\\\\\\\\\\\//g\\\")\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \$$(patsubst %.d,%.o, \$$@): \\$$\$$(\$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\")) makefile\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \\$$\$$(CXX) \\$$\$$(CXXFLAGS) \\$$\$$< -o \$$(patsubst %.d,%.o, \$$@)\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \" > \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/makefile: makefile$${NEW_LINE}\ - mkdir -p \$$(dir \$$@)$${NEW_LINE}\ - cp makefile \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/: FORCE | %/makefile$${NEW_LINE}\ - @accesstime=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - \$$(MAKE) -C \$$@ SRCDIR=\$$(SRCDIR)\$$(notdir \$$(patsubst %/, %, \$$@))/ OBJECTS_BASE_DIR=\$$(OBJECTS_BASE_DIR) SOURCES_BASE_DIR=\$$(SOURCES_BASE_DIR) CXX_OTHER_FLAGS=\"\$$(CXX_OTHER_FLAGS)\" && \\$${NEW_LINE}\ - accesstime2=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - if [ "\$$\$$accesstime" -ne "\$$\$$accesstime2" ]; then \\$${NEW_LINE}\ - touch .; \\$${NEW_LINE}\ - fi$${NEW_LINE}\ - $${NEW_LINE}\ - FORCE:$${NEW_LINE}\ - $${NEW_LINE}\ - -include \$$(DEPENDENCIES)" > $@ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# final lib/bin construction - -bin-debug/$(EXECUTABLE): obj-debug/ $(OBJECTS_DEBUG) - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG) - -bin-release/$(EXECUTABLE): obj-release/ $(OBJECTS_RELEASE) - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# subdir make calls - -obj-debug/: FORCE | obj-debug/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-debug) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-g -Og -DDEBUG" - -obj-release/: FORCE | obj-release/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-release) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-O3 -DNDEBUG -DRELEASE $(LTO_PARAM)" - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# objects dependencies - -$(OBJECTS_DEBUG): obj-debug/ - -$(OBJECTS_RELEASE): obj-release/ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# standalone main targets - -build-code-debug: bin-debug/$(EXECUTABLE) - -build-code-release: bin-release/$(EXECUTABLE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# do all main targets - -debug: - $(MAKE) build-code-debug - -release: - $(MAKE) build-code-release - -clean: clean-debug clean-release - $(RM) -r doc - -clean-debug: - if [ -L obj-debug ]; then\ - $(RM) -r `readlink obj-debug`;\ - fi - if [ -L bin-debug ]; then\ - $(RM) -r `readlink bin-debug`;\ - fi - $(RM) -r *.o *.d bin-debug obj-debug - -clean-release: - if [ -L obj-release ]; then\ - $(RM) -r `readlink obj-release`;\ - fi - if [ -L lib-release ]; then\ - $(RM) -r `readlink lib-release`;\ - fi - $(RM) -r *.o *.d bin-release obj-release - -doc: - doxygen +-include ../build.conf +-include ../makefile-binary diff --git a/aconversions2/makefile b/aconversions2/makefile index 4064fd0131..bd9fb6f7bc 100644 --- a/aconversions2/makefile +++ b/aconversions2/makefile @@ -1,174 +1,3 @@ -SHELL:=/bin/bash - --include ../build.conf -include makefile.conf - -LTO_PARAM:= -ifeq ($(USE_LTO),1) -LTO_PARAM:= -flto -endif - -define NEW_LINE - - -endef - -export NEW_LINE - -CXX_FLAGS := -Wall -pedantic -Wextra -Werror -Wshadow -Wpointer-arith -Wcast-qual -Wdelete-non-virtual-dtor -Wredundant-decls - -LDFLAGS_DEBUG:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-debug, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) -Wl,-rpath,. - -LDFLAGS_RELEASE:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-release, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) $(LTO_PARAM) -Wl,-rpath,. - -OBJECTS_DEBUG:=$(patsubst src/%.cpp,obj-debug/%.o, $(shell find src/ -name *cpp)) - -OBJECTS_RELEASE:=$(patsubst src/%.cpp,obj-release/%.o, $(shell find src/ -name *cpp)) - -.PHONY: all build-debug clean-debug doc - -all: - @echo "What to do master?" - -FORCE: - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# make subdir makefile - -%/makefile: makefile makefile.conf - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - echo "\ - SHELL:=/bin/bash$${NEW_LINE}\ - SRCDIR:=$${NEW_LINE}\ - $${NEW_LINE}\ - define NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - $${NEW_LINE}\ - endef$${NEW_LINE}\ - $${NEW_LINE}\ - export NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - CXXFLAGS:= -pipe -std=c++11 \$$(CXX_OTHER_FLAGS) -c $(CXX_FLAGS) -fPIC \$$(addprefix -I, \$$(realpath $(INCLUDE_PATHS)))$${NEW_LINE}\ - $${NEW_LINE}\ - SOURCES:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -type f -name \"*.cpp\")$${NEW_LINE}\ - DEPENDENCIES:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d, \$$(SOURCES))$${NEW_LINE}\ - OBJECTS:= \$$(patsubst %.d, %.o, \$$(DEPENDENCIES))$${NEW_LINE}\ - SOURCES_DIRS:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -mindepth 1 -type d)$${NEW_LINE}\ - OBJECTS_DIRS:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%, %/, \$$(SOURCES_DIRS))$${NEW_LINE}\ - OBJECTS_DIRS_MAKEFILES:= \$$(patsubst %, %makefile, \$$(OBJECTS_DIRS))$${NEW_LINE}\ - $${NEW_LINE}\ - .PHONY: all$${NEW_LINE}\ - .PRECIOUS: \$$(DEPENDECIES) \$$(OBJECTS_DIRS_MAKEFILES)$${NEW_LINE}\ - $${NEW_LINE}\ - all: \$$(OBJECTS_DIRS) \$$(OBJECTS)$${NEW_LINE}\ - $${NEW_LINE}\ - %.d: makefile$${NEW_LINE}\ - @echo \"\\$${NEW_LINE}\ - \$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\") = \\$$\$$(shell (\\$$\$$(CXX) -M \\$$\$$(CXXFLAGS) \$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) 2>/dev/null || echo \\\"\$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) FORCE\\\") | sed \\\"s/.*://g;s/\\\\\\\\\\\\\\\\//g\\\")\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \$$(patsubst %.d,%.o, \$$@): \\$$\$$(\$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\")) makefile\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \\$$\$$(CXX) \\$$\$$(CXXFLAGS) \\$$\$$< -o \$$(patsubst %.d,%.o, \$$@)\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \" > \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/makefile: makefile$${NEW_LINE}\ - mkdir -p \$$(dir \$$@)$${NEW_LINE}\ - cp makefile \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/: FORCE | %/makefile$${NEW_LINE}\ - @accesstime=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - \$$(MAKE) -C \$$@ SRCDIR=\$$(SRCDIR)\$$(notdir \$$(patsubst %/, %, \$$@))/ OBJECTS_BASE_DIR=\$$(OBJECTS_BASE_DIR) SOURCES_BASE_DIR=\$$(SOURCES_BASE_DIR) CXX_OTHER_FLAGS=\"\$$(CXX_OTHER_FLAGS)\" && \\$${NEW_LINE}\ - accesstime2=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - if [ "\$$\$$accesstime" -ne "\$$\$$accesstime2" ]; then \\$${NEW_LINE}\ - touch .; \\$${NEW_LINE}\ - fi$${NEW_LINE}\ - $${NEW_LINE}\ - FORCE:$${NEW_LINE}\ - $${NEW_LINE}\ - -include \$$(DEPENDENCIES)" > $@ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# final lib/bin construction - -bin-debug/$(EXECUTABLE): obj-debug/ $(OBJECTS_DEBUG) - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG) - -bin-release/$(EXECUTABLE): obj-release/ $(OBJECTS_RELEASE) - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# subdir make calls - -obj-debug/: FORCE | obj-debug/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-debug) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-g -Og -DDEBUG" - -obj-release/: FORCE | obj-release/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-release) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-O3 -DNDEBUG -DRELEASE $(LTO_PARAM)" - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# objects dependencies - -$(OBJECTS_DEBUG): obj-debug/ - -$(OBJECTS_RELEASE): obj-release/ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# standalone main targets - -build-code-debug: bin-debug/$(EXECUTABLE) - -build-code-release: bin-release/$(EXECUTABLE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# do all main targets - -debug: - $(MAKE) build-code-debug - -release: - $(MAKE) build-code-release - -clean: clean-debug clean-release - $(RM) -r doc - -clean-debug: - if [ -L obj-debug ]; then\ - $(RM) -r `readlink obj-debug`;\ - fi - if [ -L bin-debug ]; then\ - $(RM) -r `readlink bin-debug`;\ - fi - $(RM) -r *.o *.d bin-debug obj-debug - -clean-release: - if [ -L obj-release ]; then\ - $(RM) -r `readlink obj-release`;\ - fi - if [ -L lib-release ]; then\ - $(RM) -r `readlink lib-release`;\ - fi - $(RM) -r *.o *.d bin-release obj-release - -doc: - doxygen +-include ../build.conf +-include ../makefile-binary diff --git a/aconvert2/makefile b/aconvert2/makefile index 4064fd0131..bd9fb6f7bc 100644 --- a/aconvert2/makefile +++ b/aconvert2/makefile @@ -1,174 +1,3 @@ -SHELL:=/bin/bash - --include ../build.conf -include makefile.conf - -LTO_PARAM:= -ifeq ($(USE_LTO),1) -LTO_PARAM:= -flto -endif - -define NEW_LINE - - -endef - -export NEW_LINE - -CXX_FLAGS := -Wall -pedantic -Wextra -Werror -Wshadow -Wpointer-arith -Wcast-qual -Wdelete-non-virtual-dtor -Wredundant-decls - -LDFLAGS_DEBUG:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-debug, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) -Wl,-rpath,. - -LDFLAGS_RELEASE:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-release, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) $(LTO_PARAM) -Wl,-rpath,. - -OBJECTS_DEBUG:=$(patsubst src/%.cpp,obj-debug/%.o, $(shell find src/ -name *cpp)) - -OBJECTS_RELEASE:=$(patsubst src/%.cpp,obj-release/%.o, $(shell find src/ -name *cpp)) - -.PHONY: all build-debug clean-debug doc - -all: - @echo "What to do master?" - -FORCE: - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# make subdir makefile - -%/makefile: makefile makefile.conf - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - echo "\ - SHELL:=/bin/bash$${NEW_LINE}\ - SRCDIR:=$${NEW_LINE}\ - $${NEW_LINE}\ - define NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - $${NEW_LINE}\ - endef$${NEW_LINE}\ - $${NEW_LINE}\ - export NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - CXXFLAGS:= -pipe -std=c++11 \$$(CXX_OTHER_FLAGS) -c $(CXX_FLAGS) -fPIC \$$(addprefix -I, \$$(realpath $(INCLUDE_PATHS)))$${NEW_LINE}\ - $${NEW_LINE}\ - SOURCES:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -type f -name \"*.cpp\")$${NEW_LINE}\ - DEPENDENCIES:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d, \$$(SOURCES))$${NEW_LINE}\ - OBJECTS:= \$$(patsubst %.d, %.o, \$$(DEPENDENCIES))$${NEW_LINE}\ - SOURCES_DIRS:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -mindepth 1 -type d)$${NEW_LINE}\ - OBJECTS_DIRS:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%, %/, \$$(SOURCES_DIRS))$${NEW_LINE}\ - OBJECTS_DIRS_MAKEFILES:= \$$(patsubst %, %makefile, \$$(OBJECTS_DIRS))$${NEW_LINE}\ - $${NEW_LINE}\ - .PHONY: all$${NEW_LINE}\ - .PRECIOUS: \$$(DEPENDECIES) \$$(OBJECTS_DIRS_MAKEFILES)$${NEW_LINE}\ - $${NEW_LINE}\ - all: \$$(OBJECTS_DIRS) \$$(OBJECTS)$${NEW_LINE}\ - $${NEW_LINE}\ - %.d: makefile$${NEW_LINE}\ - @echo \"\\$${NEW_LINE}\ - \$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\") = \\$$\$$(shell (\\$$\$$(CXX) -M \\$$\$$(CXXFLAGS) \$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) 2>/dev/null || echo \\\"\$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) FORCE\\\") | sed \\\"s/.*://g;s/\\\\\\\\\\\\\\\\//g\\\")\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \$$(patsubst %.d,%.o, \$$@): \\$$\$$(\$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\")) makefile\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \\$$\$$(CXX) \\$$\$$(CXXFLAGS) \\$$\$$< -o \$$(patsubst %.d,%.o, \$$@)\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \" > \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/makefile: makefile$${NEW_LINE}\ - mkdir -p \$$(dir \$$@)$${NEW_LINE}\ - cp makefile \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/: FORCE | %/makefile$${NEW_LINE}\ - @accesstime=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - \$$(MAKE) -C \$$@ SRCDIR=\$$(SRCDIR)\$$(notdir \$$(patsubst %/, %, \$$@))/ OBJECTS_BASE_DIR=\$$(OBJECTS_BASE_DIR) SOURCES_BASE_DIR=\$$(SOURCES_BASE_DIR) CXX_OTHER_FLAGS=\"\$$(CXX_OTHER_FLAGS)\" && \\$${NEW_LINE}\ - accesstime2=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - if [ "\$$\$$accesstime" -ne "\$$\$$accesstime2" ]; then \\$${NEW_LINE}\ - touch .; \\$${NEW_LINE}\ - fi$${NEW_LINE}\ - $${NEW_LINE}\ - FORCE:$${NEW_LINE}\ - $${NEW_LINE}\ - -include \$$(DEPENDENCIES)" > $@ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# final lib/bin construction - -bin-debug/$(EXECUTABLE): obj-debug/ $(OBJECTS_DEBUG) - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG) - -bin-release/$(EXECUTABLE): obj-release/ $(OBJECTS_RELEASE) - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# subdir make calls - -obj-debug/: FORCE | obj-debug/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-debug) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-g -Og -DDEBUG" - -obj-release/: FORCE | obj-release/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-release) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-O3 -DNDEBUG -DRELEASE $(LTO_PARAM)" - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# objects dependencies - -$(OBJECTS_DEBUG): obj-debug/ - -$(OBJECTS_RELEASE): obj-release/ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# standalone main targets - -build-code-debug: bin-debug/$(EXECUTABLE) - -build-code-release: bin-release/$(EXECUTABLE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# do all main targets - -debug: - $(MAKE) build-code-debug - -release: - $(MAKE) build-code-release - -clean: clean-debug clean-release - $(RM) -r doc - -clean-debug: - if [ -L obj-debug ]; then\ - $(RM) -r `readlink obj-debug`;\ - fi - if [ -L bin-debug ]; then\ - $(RM) -r `readlink bin-debug`;\ - fi - $(RM) -r *.o *.d bin-debug obj-debug - -clean-release: - if [ -L obj-release ]; then\ - $(RM) -r `readlink obj-release`;\ - fi - if [ -L lib-release ]; then\ - $(RM) -r `readlink lib-release`;\ - fi - $(RM) -r *.o *.d bin-release obj-release - -doc: - doxygen +-include ../build.conf +-include ../makefile-binary diff --git a/aderivation2/makefile b/aderivation2/makefile index 4064fd0131..bd9fb6f7bc 100644 --- a/aderivation2/makefile +++ b/aderivation2/makefile @@ -1,174 +1,3 @@ -SHELL:=/bin/bash - --include ../build.conf -include makefile.conf - -LTO_PARAM:= -ifeq ($(USE_LTO),1) -LTO_PARAM:= -flto -endif - -define NEW_LINE - - -endef - -export NEW_LINE - -CXX_FLAGS := -Wall -pedantic -Wextra -Werror -Wshadow -Wpointer-arith -Wcast-qual -Wdelete-non-virtual-dtor -Wredundant-decls - -LDFLAGS_DEBUG:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-debug, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) -Wl,-rpath,. - -LDFLAGS_RELEASE:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-release, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) $(LTO_PARAM) -Wl,-rpath,. - -OBJECTS_DEBUG:=$(patsubst src/%.cpp,obj-debug/%.o, $(shell find src/ -name *cpp)) - -OBJECTS_RELEASE:=$(patsubst src/%.cpp,obj-release/%.o, $(shell find src/ -name *cpp)) - -.PHONY: all build-debug clean-debug doc - -all: - @echo "What to do master?" - -FORCE: - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# make subdir makefile - -%/makefile: makefile makefile.conf - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - echo "\ - SHELL:=/bin/bash$${NEW_LINE}\ - SRCDIR:=$${NEW_LINE}\ - $${NEW_LINE}\ - define NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - $${NEW_LINE}\ - endef$${NEW_LINE}\ - $${NEW_LINE}\ - export NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - CXXFLAGS:= -pipe -std=c++11 \$$(CXX_OTHER_FLAGS) -c $(CXX_FLAGS) -fPIC \$$(addprefix -I, \$$(realpath $(INCLUDE_PATHS)))$${NEW_LINE}\ - $${NEW_LINE}\ - SOURCES:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -type f -name \"*.cpp\")$${NEW_LINE}\ - DEPENDENCIES:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d, \$$(SOURCES))$${NEW_LINE}\ - OBJECTS:= \$$(patsubst %.d, %.o, \$$(DEPENDENCIES))$${NEW_LINE}\ - SOURCES_DIRS:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -mindepth 1 -type d)$${NEW_LINE}\ - OBJECTS_DIRS:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%, %/, \$$(SOURCES_DIRS))$${NEW_LINE}\ - OBJECTS_DIRS_MAKEFILES:= \$$(patsubst %, %makefile, \$$(OBJECTS_DIRS))$${NEW_LINE}\ - $${NEW_LINE}\ - .PHONY: all$${NEW_LINE}\ - .PRECIOUS: \$$(DEPENDECIES) \$$(OBJECTS_DIRS_MAKEFILES)$${NEW_LINE}\ - $${NEW_LINE}\ - all: \$$(OBJECTS_DIRS) \$$(OBJECTS)$${NEW_LINE}\ - $${NEW_LINE}\ - %.d: makefile$${NEW_LINE}\ - @echo \"\\$${NEW_LINE}\ - \$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\") = \\$$\$$(shell (\\$$\$$(CXX) -M \\$$\$$(CXXFLAGS) \$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) 2>/dev/null || echo \\\"\$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) FORCE\\\") | sed \\\"s/.*://g;s/\\\\\\\\\\\\\\\\//g\\\")\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \$$(patsubst %.d,%.o, \$$@): \\$$\$$(\$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\")) makefile\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \\$$\$$(CXX) \\$$\$$(CXXFLAGS) \\$$\$$< -o \$$(patsubst %.d,%.o, \$$@)\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \" > \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/makefile: makefile$${NEW_LINE}\ - mkdir -p \$$(dir \$$@)$${NEW_LINE}\ - cp makefile \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/: FORCE | %/makefile$${NEW_LINE}\ - @accesstime=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - \$$(MAKE) -C \$$@ SRCDIR=\$$(SRCDIR)\$$(notdir \$$(patsubst %/, %, \$$@))/ OBJECTS_BASE_DIR=\$$(OBJECTS_BASE_DIR) SOURCES_BASE_DIR=\$$(SOURCES_BASE_DIR) CXX_OTHER_FLAGS=\"\$$(CXX_OTHER_FLAGS)\" && \\$${NEW_LINE}\ - accesstime2=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - if [ "\$$\$$accesstime" -ne "\$$\$$accesstime2" ]; then \\$${NEW_LINE}\ - touch .; \\$${NEW_LINE}\ - fi$${NEW_LINE}\ - $${NEW_LINE}\ - FORCE:$${NEW_LINE}\ - $${NEW_LINE}\ - -include \$$(DEPENDENCIES)" > $@ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# final lib/bin construction - -bin-debug/$(EXECUTABLE): obj-debug/ $(OBJECTS_DEBUG) - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG) - -bin-release/$(EXECUTABLE): obj-release/ $(OBJECTS_RELEASE) - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# subdir make calls - -obj-debug/: FORCE | obj-debug/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-debug) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-g -Og -DDEBUG" - -obj-release/: FORCE | obj-release/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-release) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-O3 -DNDEBUG -DRELEASE $(LTO_PARAM)" - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# objects dependencies - -$(OBJECTS_DEBUG): obj-debug/ - -$(OBJECTS_RELEASE): obj-release/ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# standalone main targets - -build-code-debug: bin-debug/$(EXECUTABLE) - -build-code-release: bin-release/$(EXECUTABLE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# do all main targets - -debug: - $(MAKE) build-code-debug - -release: - $(MAKE) build-code-release - -clean: clean-debug clean-release - $(RM) -r doc - -clean-debug: - if [ -L obj-debug ]; then\ - $(RM) -r `readlink obj-debug`;\ - fi - if [ -L bin-debug ]; then\ - $(RM) -r `readlink bin-debug`;\ - fi - $(RM) -r *.o *.d bin-debug obj-debug - -clean-release: - if [ -L obj-release ]; then\ - $(RM) -r `readlink obj-release`;\ - fi - if [ -L lib-release ]; then\ - $(RM) -r `readlink lib-release`;\ - fi - $(RM) -r *.o *.d bin-release obj-release - -doc: - doxygen +-include ../build.conf +-include ../makefile-binary diff --git a/adeterminize2/makefile b/adeterminize2/makefile index 4064fd0131..bd9fb6f7bc 100644 --- a/adeterminize2/makefile +++ b/adeterminize2/makefile @@ -1,174 +1,3 @@ -SHELL:=/bin/bash - --include ../build.conf -include makefile.conf - -LTO_PARAM:= -ifeq ($(USE_LTO),1) -LTO_PARAM:= -flto -endif - -define NEW_LINE - - -endef - -export NEW_LINE - -CXX_FLAGS := -Wall -pedantic -Wextra -Werror -Wshadow -Wpointer-arith -Wcast-qual -Wdelete-non-virtual-dtor -Wredundant-decls - -LDFLAGS_DEBUG:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-debug, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) -Wl,-rpath,. - -LDFLAGS_RELEASE:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-release, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) $(LTO_PARAM) -Wl,-rpath,. - -OBJECTS_DEBUG:=$(patsubst src/%.cpp,obj-debug/%.o, $(shell find src/ -name *cpp)) - -OBJECTS_RELEASE:=$(patsubst src/%.cpp,obj-release/%.o, $(shell find src/ -name *cpp)) - -.PHONY: all build-debug clean-debug doc - -all: - @echo "What to do master?" - -FORCE: - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# make subdir makefile - -%/makefile: makefile makefile.conf - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - echo "\ - SHELL:=/bin/bash$${NEW_LINE}\ - SRCDIR:=$${NEW_LINE}\ - $${NEW_LINE}\ - define NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - $${NEW_LINE}\ - endef$${NEW_LINE}\ - $${NEW_LINE}\ - export NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - CXXFLAGS:= -pipe -std=c++11 \$$(CXX_OTHER_FLAGS) -c $(CXX_FLAGS) -fPIC \$$(addprefix -I, \$$(realpath $(INCLUDE_PATHS)))$${NEW_LINE}\ - $${NEW_LINE}\ - SOURCES:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -type f -name \"*.cpp\")$${NEW_LINE}\ - DEPENDENCIES:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d, \$$(SOURCES))$${NEW_LINE}\ - OBJECTS:= \$$(patsubst %.d, %.o, \$$(DEPENDENCIES))$${NEW_LINE}\ - SOURCES_DIRS:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -mindepth 1 -type d)$${NEW_LINE}\ - OBJECTS_DIRS:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%, %/, \$$(SOURCES_DIRS))$${NEW_LINE}\ - OBJECTS_DIRS_MAKEFILES:= \$$(patsubst %, %makefile, \$$(OBJECTS_DIRS))$${NEW_LINE}\ - $${NEW_LINE}\ - .PHONY: all$${NEW_LINE}\ - .PRECIOUS: \$$(DEPENDECIES) \$$(OBJECTS_DIRS_MAKEFILES)$${NEW_LINE}\ - $${NEW_LINE}\ - all: \$$(OBJECTS_DIRS) \$$(OBJECTS)$${NEW_LINE}\ - $${NEW_LINE}\ - %.d: makefile$${NEW_LINE}\ - @echo \"\\$${NEW_LINE}\ - \$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\") = \\$$\$$(shell (\\$$\$$(CXX) -M \\$$\$$(CXXFLAGS) \$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) 2>/dev/null || echo \\\"\$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) FORCE\\\") | sed \\\"s/.*://g;s/\\\\\\\\\\\\\\\\//g\\\")\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \$$(patsubst %.d,%.o, \$$@): \\$$\$$(\$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\")) makefile\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \\$$\$$(CXX) \\$$\$$(CXXFLAGS) \\$$\$$< -o \$$(patsubst %.d,%.o, \$$@)\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \" > \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/makefile: makefile$${NEW_LINE}\ - mkdir -p \$$(dir \$$@)$${NEW_LINE}\ - cp makefile \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/: FORCE | %/makefile$${NEW_LINE}\ - @accesstime=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - \$$(MAKE) -C \$$@ SRCDIR=\$$(SRCDIR)\$$(notdir \$$(patsubst %/, %, \$$@))/ OBJECTS_BASE_DIR=\$$(OBJECTS_BASE_DIR) SOURCES_BASE_DIR=\$$(SOURCES_BASE_DIR) CXX_OTHER_FLAGS=\"\$$(CXX_OTHER_FLAGS)\" && \\$${NEW_LINE}\ - accesstime2=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - if [ "\$$\$$accesstime" -ne "\$$\$$accesstime2" ]; then \\$${NEW_LINE}\ - touch .; \\$${NEW_LINE}\ - fi$${NEW_LINE}\ - $${NEW_LINE}\ - FORCE:$${NEW_LINE}\ - $${NEW_LINE}\ - -include \$$(DEPENDENCIES)" > $@ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# final lib/bin construction - -bin-debug/$(EXECUTABLE): obj-debug/ $(OBJECTS_DEBUG) - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG) - -bin-release/$(EXECUTABLE): obj-release/ $(OBJECTS_RELEASE) - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# subdir make calls - -obj-debug/: FORCE | obj-debug/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-debug) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-g -Og -DDEBUG" - -obj-release/: FORCE | obj-release/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-release) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-O3 -DNDEBUG -DRELEASE $(LTO_PARAM)" - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# objects dependencies - -$(OBJECTS_DEBUG): obj-debug/ - -$(OBJECTS_RELEASE): obj-release/ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# standalone main targets - -build-code-debug: bin-debug/$(EXECUTABLE) - -build-code-release: bin-release/$(EXECUTABLE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# do all main targets - -debug: - $(MAKE) build-code-debug - -release: - $(MAKE) build-code-release - -clean: clean-debug clean-release - $(RM) -r doc - -clean-debug: - if [ -L obj-debug ]; then\ - $(RM) -r `readlink obj-debug`;\ - fi - if [ -L bin-debug ]; then\ - $(RM) -r `readlink bin-debug`;\ - fi - $(RM) -r *.o *.d bin-debug obj-debug - -clean-release: - if [ -L obj-release ]; then\ - $(RM) -r `readlink obj-release`;\ - fi - if [ -L lib-release ]; then\ - $(RM) -r `readlink lib-release`;\ - fi - $(RM) -r *.o *.d bin-release obj-release - -doc: - doxygen +-include ../build.conf +-include ../makefile-binary diff --git a/aecho2/makefile b/aecho2/makefile index 4064fd0131..bd9fb6f7bc 100644 --- a/aecho2/makefile +++ b/aecho2/makefile @@ -1,174 +1,3 @@ -SHELL:=/bin/bash - --include ../build.conf -include makefile.conf - -LTO_PARAM:= -ifeq ($(USE_LTO),1) -LTO_PARAM:= -flto -endif - -define NEW_LINE - - -endef - -export NEW_LINE - -CXX_FLAGS := -Wall -pedantic -Wextra -Werror -Wshadow -Wpointer-arith -Wcast-qual -Wdelete-non-virtual-dtor -Wredundant-decls - -LDFLAGS_DEBUG:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-debug, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) -Wl,-rpath,. - -LDFLAGS_RELEASE:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-release, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) $(LTO_PARAM) -Wl,-rpath,. - -OBJECTS_DEBUG:=$(patsubst src/%.cpp,obj-debug/%.o, $(shell find src/ -name *cpp)) - -OBJECTS_RELEASE:=$(patsubst src/%.cpp,obj-release/%.o, $(shell find src/ -name *cpp)) - -.PHONY: all build-debug clean-debug doc - -all: - @echo "What to do master?" - -FORCE: - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# make subdir makefile - -%/makefile: makefile makefile.conf - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - echo "\ - SHELL:=/bin/bash$${NEW_LINE}\ - SRCDIR:=$${NEW_LINE}\ - $${NEW_LINE}\ - define NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - $${NEW_LINE}\ - endef$${NEW_LINE}\ - $${NEW_LINE}\ - export NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - CXXFLAGS:= -pipe -std=c++11 \$$(CXX_OTHER_FLAGS) -c $(CXX_FLAGS) -fPIC \$$(addprefix -I, \$$(realpath $(INCLUDE_PATHS)))$${NEW_LINE}\ - $${NEW_LINE}\ - SOURCES:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -type f -name \"*.cpp\")$${NEW_LINE}\ - DEPENDENCIES:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d, \$$(SOURCES))$${NEW_LINE}\ - OBJECTS:= \$$(patsubst %.d, %.o, \$$(DEPENDENCIES))$${NEW_LINE}\ - SOURCES_DIRS:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -mindepth 1 -type d)$${NEW_LINE}\ - OBJECTS_DIRS:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%, %/, \$$(SOURCES_DIRS))$${NEW_LINE}\ - OBJECTS_DIRS_MAKEFILES:= \$$(patsubst %, %makefile, \$$(OBJECTS_DIRS))$${NEW_LINE}\ - $${NEW_LINE}\ - .PHONY: all$${NEW_LINE}\ - .PRECIOUS: \$$(DEPENDECIES) \$$(OBJECTS_DIRS_MAKEFILES)$${NEW_LINE}\ - $${NEW_LINE}\ - all: \$$(OBJECTS_DIRS) \$$(OBJECTS)$${NEW_LINE}\ - $${NEW_LINE}\ - %.d: makefile$${NEW_LINE}\ - @echo \"\\$${NEW_LINE}\ - \$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\") = \\$$\$$(shell (\\$$\$$(CXX) -M \\$$\$$(CXXFLAGS) \$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) 2>/dev/null || echo \\\"\$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) FORCE\\\") | sed \\\"s/.*://g;s/\\\\\\\\\\\\\\\\//g\\\")\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \$$(patsubst %.d,%.o, \$$@): \\$$\$$(\$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\")) makefile\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \\$$\$$(CXX) \\$$\$$(CXXFLAGS) \\$$\$$< -o \$$(patsubst %.d,%.o, \$$@)\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \" > \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/makefile: makefile$${NEW_LINE}\ - mkdir -p \$$(dir \$$@)$${NEW_LINE}\ - cp makefile \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/: FORCE | %/makefile$${NEW_LINE}\ - @accesstime=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - \$$(MAKE) -C \$$@ SRCDIR=\$$(SRCDIR)\$$(notdir \$$(patsubst %/, %, \$$@))/ OBJECTS_BASE_DIR=\$$(OBJECTS_BASE_DIR) SOURCES_BASE_DIR=\$$(SOURCES_BASE_DIR) CXX_OTHER_FLAGS=\"\$$(CXX_OTHER_FLAGS)\" && \\$${NEW_LINE}\ - accesstime2=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - if [ "\$$\$$accesstime" -ne "\$$\$$accesstime2" ]; then \\$${NEW_LINE}\ - touch .; \\$${NEW_LINE}\ - fi$${NEW_LINE}\ - $${NEW_LINE}\ - FORCE:$${NEW_LINE}\ - $${NEW_LINE}\ - -include \$$(DEPENDENCIES)" > $@ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# final lib/bin construction - -bin-debug/$(EXECUTABLE): obj-debug/ $(OBJECTS_DEBUG) - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG) - -bin-release/$(EXECUTABLE): obj-release/ $(OBJECTS_RELEASE) - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# subdir make calls - -obj-debug/: FORCE | obj-debug/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-debug) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-g -Og -DDEBUG" - -obj-release/: FORCE | obj-release/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-release) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-O3 -DNDEBUG -DRELEASE $(LTO_PARAM)" - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# objects dependencies - -$(OBJECTS_DEBUG): obj-debug/ - -$(OBJECTS_RELEASE): obj-release/ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# standalone main targets - -build-code-debug: bin-debug/$(EXECUTABLE) - -build-code-release: bin-release/$(EXECUTABLE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# do all main targets - -debug: - $(MAKE) build-code-debug - -release: - $(MAKE) build-code-release - -clean: clean-debug clean-release - $(RM) -r doc - -clean-debug: - if [ -L obj-debug ]; then\ - $(RM) -r `readlink obj-debug`;\ - fi - if [ -L bin-debug ]; then\ - $(RM) -r `readlink bin-debug`;\ - fi - $(RM) -r *.o *.d bin-debug obj-debug - -clean-release: - if [ -L obj-release ]; then\ - $(RM) -r `readlink obj-release`;\ - fi - if [ -L lib-release ]; then\ - $(RM) -r `readlink lib-release`;\ - fi - $(RM) -r *.o *.d bin-release obj-release - -doc: - doxygen +-include ../build.conf +-include ../makefile-binary diff --git a/aepsilon2/makefile b/aepsilon2/makefile index 4064fd0131..bd9fb6f7bc 100644 --- a/aepsilon2/makefile +++ b/aepsilon2/makefile @@ -1,174 +1,3 @@ -SHELL:=/bin/bash - --include ../build.conf -include makefile.conf - -LTO_PARAM:= -ifeq ($(USE_LTO),1) -LTO_PARAM:= -flto -endif - -define NEW_LINE - - -endef - -export NEW_LINE - -CXX_FLAGS := -Wall -pedantic -Wextra -Werror -Wshadow -Wpointer-arith -Wcast-qual -Wdelete-non-virtual-dtor -Wredundant-decls - -LDFLAGS_DEBUG:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-debug, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) -Wl,-rpath,. - -LDFLAGS_RELEASE:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-release, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) $(LTO_PARAM) -Wl,-rpath,. - -OBJECTS_DEBUG:=$(patsubst src/%.cpp,obj-debug/%.o, $(shell find src/ -name *cpp)) - -OBJECTS_RELEASE:=$(patsubst src/%.cpp,obj-release/%.o, $(shell find src/ -name *cpp)) - -.PHONY: all build-debug clean-debug doc - -all: - @echo "What to do master?" - -FORCE: - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# make subdir makefile - -%/makefile: makefile makefile.conf - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - echo "\ - SHELL:=/bin/bash$${NEW_LINE}\ - SRCDIR:=$${NEW_LINE}\ - $${NEW_LINE}\ - define NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - $${NEW_LINE}\ - endef$${NEW_LINE}\ - $${NEW_LINE}\ - export NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - CXXFLAGS:= -pipe -std=c++11 \$$(CXX_OTHER_FLAGS) -c $(CXX_FLAGS) -fPIC \$$(addprefix -I, \$$(realpath $(INCLUDE_PATHS)))$${NEW_LINE}\ - $${NEW_LINE}\ - SOURCES:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -type f -name \"*.cpp\")$${NEW_LINE}\ - DEPENDENCIES:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d, \$$(SOURCES))$${NEW_LINE}\ - OBJECTS:= \$$(patsubst %.d, %.o, \$$(DEPENDENCIES))$${NEW_LINE}\ - SOURCES_DIRS:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -mindepth 1 -type d)$${NEW_LINE}\ - OBJECTS_DIRS:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%, %/, \$$(SOURCES_DIRS))$${NEW_LINE}\ - OBJECTS_DIRS_MAKEFILES:= \$$(patsubst %, %makefile, \$$(OBJECTS_DIRS))$${NEW_LINE}\ - $${NEW_LINE}\ - .PHONY: all$${NEW_LINE}\ - .PRECIOUS: \$$(DEPENDECIES) \$$(OBJECTS_DIRS_MAKEFILES)$${NEW_LINE}\ - $${NEW_LINE}\ - all: \$$(OBJECTS_DIRS) \$$(OBJECTS)$${NEW_LINE}\ - $${NEW_LINE}\ - %.d: makefile$${NEW_LINE}\ - @echo \"\\$${NEW_LINE}\ - \$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\") = \\$$\$$(shell (\\$$\$$(CXX) -M \\$$\$$(CXXFLAGS) \$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) 2>/dev/null || echo \\\"\$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) FORCE\\\") | sed \\\"s/.*://g;s/\\\\\\\\\\\\\\\\//g\\\")\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \$$(patsubst %.d,%.o, \$$@): \\$$\$$(\$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\")) makefile\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \\$$\$$(CXX) \\$$\$$(CXXFLAGS) \\$$\$$< -o \$$(patsubst %.d,%.o, \$$@)\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \" > \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/makefile: makefile$${NEW_LINE}\ - mkdir -p \$$(dir \$$@)$${NEW_LINE}\ - cp makefile \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/: FORCE | %/makefile$${NEW_LINE}\ - @accesstime=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - \$$(MAKE) -C \$$@ SRCDIR=\$$(SRCDIR)\$$(notdir \$$(patsubst %/, %, \$$@))/ OBJECTS_BASE_DIR=\$$(OBJECTS_BASE_DIR) SOURCES_BASE_DIR=\$$(SOURCES_BASE_DIR) CXX_OTHER_FLAGS=\"\$$(CXX_OTHER_FLAGS)\" && \\$${NEW_LINE}\ - accesstime2=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - if [ "\$$\$$accesstime" -ne "\$$\$$accesstime2" ]; then \\$${NEW_LINE}\ - touch .; \\$${NEW_LINE}\ - fi$${NEW_LINE}\ - $${NEW_LINE}\ - FORCE:$${NEW_LINE}\ - $${NEW_LINE}\ - -include \$$(DEPENDENCIES)" > $@ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# final lib/bin construction - -bin-debug/$(EXECUTABLE): obj-debug/ $(OBJECTS_DEBUG) - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG) - -bin-release/$(EXECUTABLE): obj-release/ $(OBJECTS_RELEASE) - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# subdir make calls - -obj-debug/: FORCE | obj-debug/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-debug) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-g -Og -DDEBUG" - -obj-release/: FORCE | obj-release/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-release) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-O3 -DNDEBUG -DRELEASE $(LTO_PARAM)" - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# objects dependencies - -$(OBJECTS_DEBUG): obj-debug/ - -$(OBJECTS_RELEASE): obj-release/ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# standalone main targets - -build-code-debug: bin-debug/$(EXECUTABLE) - -build-code-release: bin-release/$(EXECUTABLE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# do all main targets - -debug: - $(MAKE) build-code-debug - -release: - $(MAKE) build-code-release - -clean: clean-debug clean-release - $(RM) -r doc - -clean-debug: - if [ -L obj-debug ]; then\ - $(RM) -r `readlink obj-debug`;\ - fi - if [ -L bin-debug ]; then\ - $(RM) -r `readlink bin-debug`;\ - fi - $(RM) -r *.o *.d bin-debug obj-debug - -clean-release: - if [ -L obj-release ]; then\ - $(RM) -r `readlink obj-release`;\ - fi - if [ -L lib-release ]; then\ - $(RM) -r `readlink lib-release`;\ - fi - $(RM) -r *.o *.d bin-release obj-release - -doc: - doxygen +-include ../build.conf +-include ../makefile-binary diff --git a/agenerate2/makefile b/agenerate2/makefile index 4064fd0131..bd9fb6f7bc 100644 --- a/agenerate2/makefile +++ b/agenerate2/makefile @@ -1,174 +1,3 @@ -SHELL:=/bin/bash - --include ../build.conf -include makefile.conf - -LTO_PARAM:= -ifeq ($(USE_LTO),1) -LTO_PARAM:= -flto -endif - -define NEW_LINE - - -endef - -export NEW_LINE - -CXX_FLAGS := -Wall -pedantic -Wextra -Werror -Wshadow -Wpointer-arith -Wcast-qual -Wdelete-non-virtual-dtor -Wredundant-decls - -LDFLAGS_DEBUG:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-debug, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) -Wl,-rpath,. - -LDFLAGS_RELEASE:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-release, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) $(LTO_PARAM) -Wl,-rpath,. - -OBJECTS_DEBUG:=$(patsubst src/%.cpp,obj-debug/%.o, $(shell find src/ -name *cpp)) - -OBJECTS_RELEASE:=$(patsubst src/%.cpp,obj-release/%.o, $(shell find src/ -name *cpp)) - -.PHONY: all build-debug clean-debug doc - -all: - @echo "What to do master?" - -FORCE: - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# make subdir makefile - -%/makefile: makefile makefile.conf - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - echo "\ - SHELL:=/bin/bash$${NEW_LINE}\ - SRCDIR:=$${NEW_LINE}\ - $${NEW_LINE}\ - define NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - $${NEW_LINE}\ - endef$${NEW_LINE}\ - $${NEW_LINE}\ - export NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - CXXFLAGS:= -pipe -std=c++11 \$$(CXX_OTHER_FLAGS) -c $(CXX_FLAGS) -fPIC \$$(addprefix -I, \$$(realpath $(INCLUDE_PATHS)))$${NEW_LINE}\ - $${NEW_LINE}\ - SOURCES:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -type f -name \"*.cpp\")$${NEW_LINE}\ - DEPENDENCIES:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d, \$$(SOURCES))$${NEW_LINE}\ - OBJECTS:= \$$(patsubst %.d, %.o, \$$(DEPENDENCIES))$${NEW_LINE}\ - SOURCES_DIRS:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -mindepth 1 -type d)$${NEW_LINE}\ - OBJECTS_DIRS:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%, %/, \$$(SOURCES_DIRS))$${NEW_LINE}\ - OBJECTS_DIRS_MAKEFILES:= \$$(patsubst %, %makefile, \$$(OBJECTS_DIRS))$${NEW_LINE}\ - $${NEW_LINE}\ - .PHONY: all$${NEW_LINE}\ - .PRECIOUS: \$$(DEPENDECIES) \$$(OBJECTS_DIRS_MAKEFILES)$${NEW_LINE}\ - $${NEW_LINE}\ - all: \$$(OBJECTS_DIRS) \$$(OBJECTS)$${NEW_LINE}\ - $${NEW_LINE}\ - %.d: makefile$${NEW_LINE}\ - @echo \"\\$${NEW_LINE}\ - \$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\") = \\$$\$$(shell (\\$$\$$(CXX) -M \\$$\$$(CXXFLAGS) \$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) 2>/dev/null || echo \\\"\$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) FORCE\\\") | sed \\\"s/.*://g;s/\\\\\\\\\\\\\\\\//g\\\")\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \$$(patsubst %.d,%.o, \$$@): \\$$\$$(\$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\")) makefile\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \\$$\$$(CXX) \\$$\$$(CXXFLAGS) \\$$\$$< -o \$$(patsubst %.d,%.o, \$$@)\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \" > \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/makefile: makefile$${NEW_LINE}\ - mkdir -p \$$(dir \$$@)$${NEW_LINE}\ - cp makefile \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/: FORCE | %/makefile$${NEW_LINE}\ - @accesstime=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - \$$(MAKE) -C \$$@ SRCDIR=\$$(SRCDIR)\$$(notdir \$$(patsubst %/, %, \$$@))/ OBJECTS_BASE_DIR=\$$(OBJECTS_BASE_DIR) SOURCES_BASE_DIR=\$$(SOURCES_BASE_DIR) CXX_OTHER_FLAGS=\"\$$(CXX_OTHER_FLAGS)\" && \\$${NEW_LINE}\ - accesstime2=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - if [ "\$$\$$accesstime" -ne "\$$\$$accesstime2" ]; then \\$${NEW_LINE}\ - touch .; \\$${NEW_LINE}\ - fi$${NEW_LINE}\ - $${NEW_LINE}\ - FORCE:$${NEW_LINE}\ - $${NEW_LINE}\ - -include \$$(DEPENDENCIES)" > $@ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# final lib/bin construction - -bin-debug/$(EXECUTABLE): obj-debug/ $(OBJECTS_DEBUG) - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG) - -bin-release/$(EXECUTABLE): obj-release/ $(OBJECTS_RELEASE) - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# subdir make calls - -obj-debug/: FORCE | obj-debug/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-debug) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-g -Og -DDEBUG" - -obj-release/: FORCE | obj-release/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-release) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-O3 -DNDEBUG -DRELEASE $(LTO_PARAM)" - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# objects dependencies - -$(OBJECTS_DEBUG): obj-debug/ - -$(OBJECTS_RELEASE): obj-release/ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# standalone main targets - -build-code-debug: bin-debug/$(EXECUTABLE) - -build-code-release: bin-release/$(EXECUTABLE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# do all main targets - -debug: - $(MAKE) build-code-debug - -release: - $(MAKE) build-code-release - -clean: clean-debug clean-release - $(RM) -r doc - -clean-debug: - if [ -L obj-debug ]; then\ - $(RM) -r `readlink obj-debug`;\ - fi - if [ -L bin-debug ]; then\ - $(RM) -r `readlink bin-debug`;\ - fi - $(RM) -r *.o *.d bin-debug obj-debug - -clean-release: - if [ -L obj-release ]; then\ - $(RM) -r `readlink obj-release`;\ - fi - if [ -L lib-release ]; then\ - $(RM) -r `readlink lib-release`;\ - fi - $(RM) -r *.o *.d bin-release obj-release - -doc: - doxygen +-include ../build.conf +-include ../makefile-binary diff --git a/aintegral2/makefile b/aintegral2/makefile index 4064fd0131..bd9fb6f7bc 100644 --- a/aintegral2/makefile +++ b/aintegral2/makefile @@ -1,174 +1,3 @@ -SHELL:=/bin/bash - --include ../build.conf -include makefile.conf - -LTO_PARAM:= -ifeq ($(USE_LTO),1) -LTO_PARAM:= -flto -endif - -define NEW_LINE - - -endef - -export NEW_LINE - -CXX_FLAGS := -Wall -pedantic -Wextra -Werror -Wshadow -Wpointer-arith -Wcast-qual -Wdelete-non-virtual-dtor -Wredundant-decls - -LDFLAGS_DEBUG:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-debug, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) -Wl,-rpath,. - -LDFLAGS_RELEASE:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-release, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) $(LTO_PARAM) -Wl,-rpath,. - -OBJECTS_DEBUG:=$(patsubst src/%.cpp,obj-debug/%.o, $(shell find src/ -name *cpp)) - -OBJECTS_RELEASE:=$(patsubst src/%.cpp,obj-release/%.o, $(shell find src/ -name *cpp)) - -.PHONY: all build-debug clean-debug doc - -all: - @echo "What to do master?" - -FORCE: - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# make subdir makefile - -%/makefile: makefile makefile.conf - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - echo "\ - SHELL:=/bin/bash$${NEW_LINE}\ - SRCDIR:=$${NEW_LINE}\ - $${NEW_LINE}\ - define NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - $${NEW_LINE}\ - endef$${NEW_LINE}\ - $${NEW_LINE}\ - export NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - CXXFLAGS:= -pipe -std=c++11 \$$(CXX_OTHER_FLAGS) -c $(CXX_FLAGS) -fPIC \$$(addprefix -I, \$$(realpath $(INCLUDE_PATHS)))$${NEW_LINE}\ - $${NEW_LINE}\ - SOURCES:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -type f -name \"*.cpp\")$${NEW_LINE}\ - DEPENDENCIES:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d, \$$(SOURCES))$${NEW_LINE}\ - OBJECTS:= \$$(patsubst %.d, %.o, \$$(DEPENDENCIES))$${NEW_LINE}\ - SOURCES_DIRS:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -mindepth 1 -type d)$${NEW_LINE}\ - OBJECTS_DIRS:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%, %/, \$$(SOURCES_DIRS))$${NEW_LINE}\ - OBJECTS_DIRS_MAKEFILES:= \$$(patsubst %, %makefile, \$$(OBJECTS_DIRS))$${NEW_LINE}\ - $${NEW_LINE}\ - .PHONY: all$${NEW_LINE}\ - .PRECIOUS: \$$(DEPENDECIES) \$$(OBJECTS_DIRS_MAKEFILES)$${NEW_LINE}\ - $${NEW_LINE}\ - all: \$$(OBJECTS_DIRS) \$$(OBJECTS)$${NEW_LINE}\ - $${NEW_LINE}\ - %.d: makefile$${NEW_LINE}\ - @echo \"\\$${NEW_LINE}\ - \$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\") = \\$$\$$(shell (\\$$\$$(CXX) -M \\$$\$$(CXXFLAGS) \$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) 2>/dev/null || echo \\\"\$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) FORCE\\\") | sed \\\"s/.*://g;s/\\\\\\\\\\\\\\\\//g\\\")\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \$$(patsubst %.d,%.o, \$$@): \\$$\$$(\$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\")) makefile\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \\$$\$$(CXX) \\$$\$$(CXXFLAGS) \\$$\$$< -o \$$(patsubst %.d,%.o, \$$@)\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \" > \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/makefile: makefile$${NEW_LINE}\ - mkdir -p \$$(dir \$$@)$${NEW_LINE}\ - cp makefile \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/: FORCE | %/makefile$${NEW_LINE}\ - @accesstime=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - \$$(MAKE) -C \$$@ SRCDIR=\$$(SRCDIR)\$$(notdir \$$(patsubst %/, %, \$$@))/ OBJECTS_BASE_DIR=\$$(OBJECTS_BASE_DIR) SOURCES_BASE_DIR=\$$(SOURCES_BASE_DIR) CXX_OTHER_FLAGS=\"\$$(CXX_OTHER_FLAGS)\" && \\$${NEW_LINE}\ - accesstime2=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - if [ "\$$\$$accesstime" -ne "\$$\$$accesstime2" ]; then \\$${NEW_LINE}\ - touch .; \\$${NEW_LINE}\ - fi$${NEW_LINE}\ - $${NEW_LINE}\ - FORCE:$${NEW_LINE}\ - $${NEW_LINE}\ - -include \$$(DEPENDENCIES)" > $@ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# final lib/bin construction - -bin-debug/$(EXECUTABLE): obj-debug/ $(OBJECTS_DEBUG) - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG) - -bin-release/$(EXECUTABLE): obj-release/ $(OBJECTS_RELEASE) - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# subdir make calls - -obj-debug/: FORCE | obj-debug/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-debug) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-g -Og -DDEBUG" - -obj-release/: FORCE | obj-release/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-release) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-O3 -DNDEBUG -DRELEASE $(LTO_PARAM)" - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# objects dependencies - -$(OBJECTS_DEBUG): obj-debug/ - -$(OBJECTS_RELEASE): obj-release/ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# standalone main targets - -build-code-debug: bin-debug/$(EXECUTABLE) - -build-code-release: bin-release/$(EXECUTABLE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# do all main targets - -debug: - $(MAKE) build-code-debug - -release: - $(MAKE) build-code-release - -clean: clean-debug clean-release - $(RM) -r doc - -clean-debug: - if [ -L obj-debug ]; then\ - $(RM) -r `readlink obj-debug`;\ - fi - if [ -L bin-debug ]; then\ - $(RM) -r `readlink bin-debug`;\ - fi - $(RM) -r *.o *.d bin-debug obj-debug - -clean-release: - if [ -L obj-release ]; then\ - $(RM) -r `readlink obj-release`;\ - fi - if [ -L lib-release ]; then\ - $(RM) -r `readlink lib-release`;\ - fi - $(RM) -r *.o *.d bin-release obj-release - -doc: - doxygen +-include ../build.conf +-include ../makefile-binary diff --git a/aintrospection2/makefile b/aintrospection2/makefile index 4064fd0131..bd9fb6f7bc 100644 --- a/aintrospection2/makefile +++ b/aintrospection2/makefile @@ -1,174 +1,3 @@ -SHELL:=/bin/bash - --include ../build.conf -include makefile.conf - -LTO_PARAM:= -ifeq ($(USE_LTO),1) -LTO_PARAM:= -flto -endif - -define NEW_LINE - - -endef - -export NEW_LINE - -CXX_FLAGS := -Wall -pedantic -Wextra -Werror -Wshadow -Wpointer-arith -Wcast-qual -Wdelete-non-virtual-dtor -Wredundant-decls - -LDFLAGS_DEBUG:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-debug, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) -Wl,-rpath,. - -LDFLAGS_RELEASE:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-release, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) $(LTO_PARAM) -Wl,-rpath,. - -OBJECTS_DEBUG:=$(patsubst src/%.cpp,obj-debug/%.o, $(shell find src/ -name *cpp)) - -OBJECTS_RELEASE:=$(patsubst src/%.cpp,obj-release/%.o, $(shell find src/ -name *cpp)) - -.PHONY: all build-debug clean-debug doc - -all: - @echo "What to do master?" - -FORCE: - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# make subdir makefile - -%/makefile: makefile makefile.conf - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - echo "\ - SHELL:=/bin/bash$${NEW_LINE}\ - SRCDIR:=$${NEW_LINE}\ - $${NEW_LINE}\ - define NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - $${NEW_LINE}\ - endef$${NEW_LINE}\ - $${NEW_LINE}\ - export NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - CXXFLAGS:= -pipe -std=c++11 \$$(CXX_OTHER_FLAGS) -c $(CXX_FLAGS) -fPIC \$$(addprefix -I, \$$(realpath $(INCLUDE_PATHS)))$${NEW_LINE}\ - $${NEW_LINE}\ - SOURCES:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -type f -name \"*.cpp\")$${NEW_LINE}\ - DEPENDENCIES:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d, \$$(SOURCES))$${NEW_LINE}\ - OBJECTS:= \$$(patsubst %.d, %.o, \$$(DEPENDENCIES))$${NEW_LINE}\ - SOURCES_DIRS:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -mindepth 1 -type d)$${NEW_LINE}\ - OBJECTS_DIRS:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%, %/, \$$(SOURCES_DIRS))$${NEW_LINE}\ - OBJECTS_DIRS_MAKEFILES:= \$$(patsubst %, %makefile, \$$(OBJECTS_DIRS))$${NEW_LINE}\ - $${NEW_LINE}\ - .PHONY: all$${NEW_LINE}\ - .PRECIOUS: \$$(DEPENDECIES) \$$(OBJECTS_DIRS_MAKEFILES)$${NEW_LINE}\ - $${NEW_LINE}\ - all: \$$(OBJECTS_DIRS) \$$(OBJECTS)$${NEW_LINE}\ - $${NEW_LINE}\ - %.d: makefile$${NEW_LINE}\ - @echo \"\\$${NEW_LINE}\ - \$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\") = \\$$\$$(shell (\\$$\$$(CXX) -M \\$$\$$(CXXFLAGS) \$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) 2>/dev/null || echo \\\"\$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) FORCE\\\") | sed \\\"s/.*://g;s/\\\\\\\\\\\\\\\\//g\\\")\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \$$(patsubst %.d,%.o, \$$@): \\$$\$$(\$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\")) makefile\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \\$$\$$(CXX) \\$$\$$(CXXFLAGS) \\$$\$$< -o \$$(patsubst %.d,%.o, \$$@)\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \" > \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/makefile: makefile$${NEW_LINE}\ - mkdir -p \$$(dir \$$@)$${NEW_LINE}\ - cp makefile \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/: FORCE | %/makefile$${NEW_LINE}\ - @accesstime=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - \$$(MAKE) -C \$$@ SRCDIR=\$$(SRCDIR)\$$(notdir \$$(patsubst %/, %, \$$@))/ OBJECTS_BASE_DIR=\$$(OBJECTS_BASE_DIR) SOURCES_BASE_DIR=\$$(SOURCES_BASE_DIR) CXX_OTHER_FLAGS=\"\$$(CXX_OTHER_FLAGS)\" && \\$${NEW_LINE}\ - accesstime2=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - if [ "\$$\$$accesstime" -ne "\$$\$$accesstime2" ]; then \\$${NEW_LINE}\ - touch .; \\$${NEW_LINE}\ - fi$${NEW_LINE}\ - $${NEW_LINE}\ - FORCE:$${NEW_LINE}\ - $${NEW_LINE}\ - -include \$$(DEPENDENCIES)" > $@ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# final lib/bin construction - -bin-debug/$(EXECUTABLE): obj-debug/ $(OBJECTS_DEBUG) - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG) - -bin-release/$(EXECUTABLE): obj-release/ $(OBJECTS_RELEASE) - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# subdir make calls - -obj-debug/: FORCE | obj-debug/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-debug) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-g -Og -DDEBUG" - -obj-release/: FORCE | obj-release/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-release) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-O3 -DNDEBUG -DRELEASE $(LTO_PARAM)" - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# objects dependencies - -$(OBJECTS_DEBUG): obj-debug/ - -$(OBJECTS_RELEASE): obj-release/ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# standalone main targets - -build-code-debug: bin-debug/$(EXECUTABLE) - -build-code-release: bin-release/$(EXECUTABLE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# do all main targets - -debug: - $(MAKE) build-code-debug - -release: - $(MAKE) build-code-release - -clean: clean-debug clean-release - $(RM) -r doc - -clean-debug: - if [ -L obj-debug ]; then\ - $(RM) -r `readlink obj-debug`;\ - fi - if [ -L bin-debug ]; then\ - $(RM) -r `readlink bin-debug`;\ - fi - $(RM) -r *.o *.d bin-debug obj-debug - -clean-release: - if [ -L obj-release ]; then\ - $(RM) -r `readlink obj-release`;\ - fi - if [ -L lib-release ]; then\ - $(RM) -r `readlink lib-release`;\ - fi - $(RM) -r *.o *.d bin-release obj-release - -doc: - doxygen +-include ../build.conf +-include ../makefile-binary diff --git a/alangop2/makefile b/alangop2/makefile index 4064fd0131..bd9fb6f7bc 100644 --- a/alangop2/makefile +++ b/alangop2/makefile @@ -1,174 +1,3 @@ -SHELL:=/bin/bash - --include ../build.conf -include makefile.conf - -LTO_PARAM:= -ifeq ($(USE_LTO),1) -LTO_PARAM:= -flto -endif - -define NEW_LINE - - -endef - -export NEW_LINE - -CXX_FLAGS := -Wall -pedantic -Wextra -Werror -Wshadow -Wpointer-arith -Wcast-qual -Wdelete-non-virtual-dtor -Wredundant-decls - -LDFLAGS_DEBUG:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-debug, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) -Wl,-rpath,. - -LDFLAGS_RELEASE:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-release, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) $(LTO_PARAM) -Wl,-rpath,. - -OBJECTS_DEBUG:=$(patsubst src/%.cpp,obj-debug/%.o, $(shell find src/ -name *cpp)) - -OBJECTS_RELEASE:=$(patsubst src/%.cpp,obj-release/%.o, $(shell find src/ -name *cpp)) - -.PHONY: all build-debug clean-debug doc - -all: - @echo "What to do master?" - -FORCE: - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# make subdir makefile - -%/makefile: makefile makefile.conf - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - echo "\ - SHELL:=/bin/bash$${NEW_LINE}\ - SRCDIR:=$${NEW_LINE}\ - $${NEW_LINE}\ - define NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - $${NEW_LINE}\ - endef$${NEW_LINE}\ - $${NEW_LINE}\ - export NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - CXXFLAGS:= -pipe -std=c++11 \$$(CXX_OTHER_FLAGS) -c $(CXX_FLAGS) -fPIC \$$(addprefix -I, \$$(realpath $(INCLUDE_PATHS)))$${NEW_LINE}\ - $${NEW_LINE}\ - SOURCES:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -type f -name \"*.cpp\")$${NEW_LINE}\ - DEPENDENCIES:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d, \$$(SOURCES))$${NEW_LINE}\ - OBJECTS:= \$$(patsubst %.d, %.o, \$$(DEPENDENCIES))$${NEW_LINE}\ - SOURCES_DIRS:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -mindepth 1 -type d)$${NEW_LINE}\ - OBJECTS_DIRS:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%, %/, \$$(SOURCES_DIRS))$${NEW_LINE}\ - OBJECTS_DIRS_MAKEFILES:= \$$(patsubst %, %makefile, \$$(OBJECTS_DIRS))$${NEW_LINE}\ - $${NEW_LINE}\ - .PHONY: all$${NEW_LINE}\ - .PRECIOUS: \$$(DEPENDECIES) \$$(OBJECTS_DIRS_MAKEFILES)$${NEW_LINE}\ - $${NEW_LINE}\ - all: \$$(OBJECTS_DIRS) \$$(OBJECTS)$${NEW_LINE}\ - $${NEW_LINE}\ - %.d: makefile$${NEW_LINE}\ - @echo \"\\$${NEW_LINE}\ - \$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\") = \\$$\$$(shell (\\$$\$$(CXX) -M \\$$\$$(CXXFLAGS) \$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) 2>/dev/null || echo \\\"\$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) FORCE\\\") | sed \\\"s/.*://g;s/\\\\\\\\\\\\\\\\//g\\\")\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \$$(patsubst %.d,%.o, \$$@): \\$$\$$(\$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\")) makefile\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \\$$\$$(CXX) \\$$\$$(CXXFLAGS) \\$$\$$< -o \$$(patsubst %.d,%.o, \$$@)\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \" > \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/makefile: makefile$${NEW_LINE}\ - mkdir -p \$$(dir \$$@)$${NEW_LINE}\ - cp makefile \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/: FORCE | %/makefile$${NEW_LINE}\ - @accesstime=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - \$$(MAKE) -C \$$@ SRCDIR=\$$(SRCDIR)\$$(notdir \$$(patsubst %/, %, \$$@))/ OBJECTS_BASE_DIR=\$$(OBJECTS_BASE_DIR) SOURCES_BASE_DIR=\$$(SOURCES_BASE_DIR) CXX_OTHER_FLAGS=\"\$$(CXX_OTHER_FLAGS)\" && \\$${NEW_LINE}\ - accesstime2=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - if [ "\$$\$$accesstime" -ne "\$$\$$accesstime2" ]; then \\$${NEW_LINE}\ - touch .; \\$${NEW_LINE}\ - fi$${NEW_LINE}\ - $${NEW_LINE}\ - FORCE:$${NEW_LINE}\ - $${NEW_LINE}\ - -include \$$(DEPENDENCIES)" > $@ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# final lib/bin construction - -bin-debug/$(EXECUTABLE): obj-debug/ $(OBJECTS_DEBUG) - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG) - -bin-release/$(EXECUTABLE): obj-release/ $(OBJECTS_RELEASE) - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# subdir make calls - -obj-debug/: FORCE | obj-debug/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-debug) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-g -Og -DDEBUG" - -obj-release/: FORCE | obj-release/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-release) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-O3 -DNDEBUG -DRELEASE $(LTO_PARAM)" - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# objects dependencies - -$(OBJECTS_DEBUG): obj-debug/ - -$(OBJECTS_RELEASE): obj-release/ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# standalone main targets - -build-code-debug: bin-debug/$(EXECUTABLE) - -build-code-release: bin-release/$(EXECUTABLE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# do all main targets - -debug: - $(MAKE) build-code-debug - -release: - $(MAKE) build-code-release - -clean: clean-debug clean-release - $(RM) -r doc - -clean-debug: - if [ -L obj-debug ]; then\ - $(RM) -r `readlink obj-debug`;\ - fi - if [ -L bin-debug ]; then\ - $(RM) -r `readlink bin-debug`;\ - fi - $(RM) -r *.o *.d bin-debug obj-debug - -clean-release: - if [ -L obj-release ]; then\ - $(RM) -r `readlink obj-release`;\ - fi - if [ -L lib-release ]; then\ - $(RM) -r `readlink lib-release`;\ - fi - $(RM) -r *.o *.d bin-release obj-release - -doc: - doxygen +-include ../build.conf +-include ../makefile-binary diff --git a/alib2algo/makefile b/alib2algo/makefile index c11946de9e..0b88694038 100644 --- a/alib2algo/makefile +++ b/alib2algo/makefile @@ -1,239 +1,3 @@ -SHELL:=/bin/bash - --include ../build.conf -include makefile.conf - -LTO_PARAM:= -ifeq ($(USE_LTO),1) -LTO_PARAM:= -flto -endif - -FULL_LIBRARY:=lib$(LIBRARY).so -define NEW_LINE - - -endef - -export NEW_LINE - -CXX_FLAGS := -Wall -pedantic -Wextra -Werror -Wshadow -Wpointer-arith -Wcast-qual -Wdelete-non-virtual-dtor -Wredundant-decls - -space := $(eval) $(eval) - -LDFLAGS_DEBUG:=-rdynamic -shared -TEST_LDFLAGS_DEBUG:=-Wl,--no-as-needed -Llib-debug $(addprefix -L, $(addsuffix lib-debug, $(LINK_PATHS))) -rdynamic -l$(LIBRARY) $(addprefix -l, $(LINK_LIBRARIES)) -lcppunit -Wl,-rpath,. - -LDFLAGS_RELEASE:=-rdynamic -shared $(LTO_PARAM) -TEST_LDFLAGS_RELEASE:=-Wl,--no-as-needed -Llib-release $(addprefix -L, $(addsuffix lib-release, $(LINK_PATHS))) -rdynamic -l$(LIBRARY) $(addprefix -l, $(LINK_LIBRARIES)) -lcppunit $(LTO_PARAM) -Wl,-rpath,. - -OBJECTS_DEBUG:=$(patsubst src/%.cpp,obj-debug/%.o, $(shell find src/ -name *cpp)) -TEST_OBJECTS_DEBUG:=$(patsubst test-src/%.cpp,test-obj-debug/%.o, $(shell find test-src/ -name *cpp)) - -OBJECTS_RELEASE:=$(patsubst src/%.cpp,obj-release/%.o, $(filter-out $(wildcard src/debug/*), $(shell find src/ -name *cpp))) -TEST_OBJECTS_RELEASE:=$(patsubst test-src/%.cpp,test-obj-release/%.o, $(shell find test-src/ -name *cpp)) - -.PHONY: all debug release clean build-debug build-release clean-debug clean-release doc - -all: - @echo "What to do master?" - -FORCE: - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# make subdir makefile - -%/makefile: makefile makefile.conf - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - echo "\ - SHELL:=/bin/bash$${NEW_LINE}\ - SRCDIR:=$${NEW_LINE}\ - $${NEW_LINE}\ - define NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - $${NEW_LINE}\ - endef$${NEW_LINE}\ - $${NEW_LINE}\ - export NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - CXXFLAGS:= -pipe -std=c++11 \$$(CXX_OTHER_FLAGS) -c $(CXX_FLAGS) -fPIC \$$(addprefix -I, \$$(realpath $(INCLUDE_PATHS))) -I\$$(realpath \$$(SOURCES_BASE_DIR)/../src/)$${NEW_LINE}\ - $${NEW_LINE}\ - SOURCES:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -type f -name \"*.cpp\")$${NEW_LINE}\ - DEPENDENCIES:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d, \$$(SOURCES))$${NEW_LINE}\ - OBJECTS:= \$$(patsubst %.d, %.o, \$$(DEPENDENCIES))$${NEW_LINE}\ - SOURCES_DIRS:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -mindepth 1 -type d)$${NEW_LINE}\ - OBJECTS_DIRS:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%, %/, \$$(SOURCES_DIRS))$${NEW_LINE}\ - OBJECTS_DIRS_MAKEFILES:= \$$(patsubst %, %makefile, \$$(OBJECTS_DIRS))$${NEW_LINE}\ - $${NEW_LINE}\ - .PHONY: all$${NEW_LINE}\ - .PRECIOUS: \$$(DEPENDECIES) \$$(OBJECTS_DIRS_MAKEFILES)$${NEW_LINE}\ - $${NEW_LINE}\ - all: \$$(OBJECTS_DIRS) \$$(OBJECTS)$${NEW_LINE}\ - $${NEW_LINE}\ - %.d: makefile$${NEW_LINE}\ - @echo \"\\$${NEW_LINE}\ - \$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\") = \\$$\$$(shell (\\$$\$$(CXX) -M \\$$\$$(CXXFLAGS) \$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) 2>/dev/null || echo \\\"\$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) FORCE\\\") | sed \\\"s/.*://g;s/\\\\\\\\\\\\\\\\//g\\\")\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \$$(patsubst %.d,%.o, \$$@): \\$$\$$(\$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\")) makefile\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \\$$\$$(CXX) \\$$\$$(CXXFLAGS) \\$$\$$< -o \$$(patsubst %.d,%.o, \$$@)\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \" > \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/makefile: makefile$${NEW_LINE}\ - mkdir -p \$$(dir \$$@)$${NEW_LINE}\ - cp makefile \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/: FORCE | %/makefile$${NEW_LINE}\ - @accesstime=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - \$$(MAKE) -C \$$@ SRCDIR=\$$(SRCDIR)\$$(notdir \$$(patsubst %/, %, \$$@))/ OBJECTS_BASE_DIR=\$$(OBJECTS_BASE_DIR) SOURCES_BASE_DIR=\$$(SOURCES_BASE_DIR) CXX_OTHER_FLAGS=\"\$$(CXX_OTHER_FLAGS)\" && \\$${NEW_LINE}\ - accesstime2=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - if [ "\$$\$$accesstime" -ne "\$$\$$accesstime2" ]; then \\$${NEW_LINE}\ - touch .; \\$${NEW_LINE}\ - fi$${NEW_LINE}\ - $${NEW_LINE}\ - FORCE:$${NEW_LINE}\ - $${NEW_LINE}\ - -include \$$(DEPENDENCIES)" > $@ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# final lib/bin construction - -lib-debug/$(FULL_LIBRARY): $(OBJECTS_DEBUG) obj-debug/ - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG) - -lib-release/$(FULL_LIBRARY): $(OBJECTS_RELEASE) obj-release/ - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE) - -test-bin-debug/$(TESTBIN): $(TEST_OBJECTS_DEBUG) test-obj-debug/ - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(TEST_OBJECTS_DEBUG) -o $@ $(TEST_LDFLAGS_DEBUG) - -test-bin-release/$(TESTBIN): $(TEST_OBJECTS_RELEASE) test-obj-release/ - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(TEST_OBJECTS_RELEASE) -o $@ $(TEST_LDFLAGS_RELEASE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# subdir make calls - -obj-debug/: FORCE obj-debug/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-debug) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-g -Og -DDEBUG" - -obj-release/: FORCE obj-release/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-release) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-O3 -DNDEBUG -DRELEASE $(LTO_PARAM)" - -test-obj-debug/: FORCE test-obj-debug/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath test-obj-debug) SOURCES_BASE_DIR=$(realpath test-src) CXX_OTHER_FLAGS="-g -Og -DDEBUG" - -test-obj-release/: FORCE test-obj-release/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath test-obj-release) SOURCES_BASE_DIR=$(realpath test-src) CXX_OTHER_FLAGS="-O3 -DNDEBUG -DRELEASE $(LTO_PARAM)" - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# objects dependencies - -$(OBJECTS_DEBUG): obj-debug/ - -$(OBJECTS_RELEASE): obj-release/ - -$(TEST_OBJECTS_DEBUG): test-obj-debug/ - -$(TEST_OBJECTS_RELEASE): test-obj-release/ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# standalone main targets - -test-unit-debug: - LD_LIBRARY_PATH="$(subst $(space),,$(addsuffix lib-debug:,$(LINK_PATHS)))lib-debug" test-bin-debug/$(TESTBIN) - -test-unit-release: - LD_LIBRARY_PATH="$(subst $(space),,$(addsuffix lib-release:,$(LINK_PATHS)))lib-release" test-bin-release/$(TESTBIN) - -build-test-debug: test-bin-debug/$(TESTBIN) - -build-test-release: test-bin-release/$(TESTBIN) - -build-code-debug: lib-debug/$(FULL_LIBRARY) - -build-code-release: lib-release/$(FULL_LIBRARY) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# do all main targets - -debug: - $(MAKE) build-code-debug - $(MAKE) build-test-debug - $(MAKE) test-unit-debug - -release: - $(MAKE) build-code-release - $(MAKE) build-test-release - $(MAKE) test-unit-release - -clean: clean-debug clean-release - $(RM) -r doc - -clean-debug: - if [ -L obj-debug ]; then\ - $(RM) -r `readlink obj-debug`;\ - fi - if [ -L lib-debug ]; then\ - $(RM) -r `readlink lib-debug`;\ - fi - if [ -L test-obj-debug ]; then\ - $(RM) -r `readlink test-obj-debug`;\ - fi - if [ -L test-bin-debug ]; then\ - $(RM) -r `readlink test-bin-debug`;\ - fi - $(RM) -r *.o *.d lib-debug obj-debug test-bin-debug test-obj-debug CppUnitTestResults.xml - -clean-release: - if [ -L obj-release ]; then\ - $(RM) -r `readlink obj-release`;\ - fi - if [ -L lib-release ]; then\ - $(RM) -r `readlink lib-release`;\ - fi - if [ -L test-obj-release ]; then\ - $(RM) -r `readlink test-obj-release`;\ - fi - if [ -L test-bin-release ]; then\ - $(RM) -r `readlink test-bin-release`;\ - fi - $(RM) -r *.o *.d lib-release obj-release test-bin-release test-obj-release CppUnitTestResults.xml - -doc: - doxygen +-include ../build.conf +-include ../makefile-library diff --git a/alib2algo_experimental/makefile b/alib2algo_experimental/makefile index c11946de9e..0b88694038 100644 --- a/alib2algo_experimental/makefile +++ b/alib2algo_experimental/makefile @@ -1,239 +1,3 @@ -SHELL:=/bin/bash - --include ../build.conf -include makefile.conf - -LTO_PARAM:= -ifeq ($(USE_LTO),1) -LTO_PARAM:= -flto -endif - -FULL_LIBRARY:=lib$(LIBRARY).so -define NEW_LINE - - -endef - -export NEW_LINE - -CXX_FLAGS := -Wall -pedantic -Wextra -Werror -Wshadow -Wpointer-arith -Wcast-qual -Wdelete-non-virtual-dtor -Wredundant-decls - -space := $(eval) $(eval) - -LDFLAGS_DEBUG:=-rdynamic -shared -TEST_LDFLAGS_DEBUG:=-Wl,--no-as-needed -Llib-debug $(addprefix -L, $(addsuffix lib-debug, $(LINK_PATHS))) -rdynamic -l$(LIBRARY) $(addprefix -l, $(LINK_LIBRARIES)) -lcppunit -Wl,-rpath,. - -LDFLAGS_RELEASE:=-rdynamic -shared $(LTO_PARAM) -TEST_LDFLAGS_RELEASE:=-Wl,--no-as-needed -Llib-release $(addprefix -L, $(addsuffix lib-release, $(LINK_PATHS))) -rdynamic -l$(LIBRARY) $(addprefix -l, $(LINK_LIBRARIES)) -lcppunit $(LTO_PARAM) -Wl,-rpath,. - -OBJECTS_DEBUG:=$(patsubst src/%.cpp,obj-debug/%.o, $(shell find src/ -name *cpp)) -TEST_OBJECTS_DEBUG:=$(patsubst test-src/%.cpp,test-obj-debug/%.o, $(shell find test-src/ -name *cpp)) - -OBJECTS_RELEASE:=$(patsubst src/%.cpp,obj-release/%.o, $(filter-out $(wildcard src/debug/*), $(shell find src/ -name *cpp))) -TEST_OBJECTS_RELEASE:=$(patsubst test-src/%.cpp,test-obj-release/%.o, $(shell find test-src/ -name *cpp)) - -.PHONY: all debug release clean build-debug build-release clean-debug clean-release doc - -all: - @echo "What to do master?" - -FORCE: - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# make subdir makefile - -%/makefile: makefile makefile.conf - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - echo "\ - SHELL:=/bin/bash$${NEW_LINE}\ - SRCDIR:=$${NEW_LINE}\ - $${NEW_LINE}\ - define NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - $${NEW_LINE}\ - endef$${NEW_LINE}\ - $${NEW_LINE}\ - export NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - CXXFLAGS:= -pipe -std=c++11 \$$(CXX_OTHER_FLAGS) -c $(CXX_FLAGS) -fPIC \$$(addprefix -I, \$$(realpath $(INCLUDE_PATHS))) -I\$$(realpath \$$(SOURCES_BASE_DIR)/../src/)$${NEW_LINE}\ - $${NEW_LINE}\ - SOURCES:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -type f -name \"*.cpp\")$${NEW_LINE}\ - DEPENDENCIES:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d, \$$(SOURCES))$${NEW_LINE}\ - OBJECTS:= \$$(patsubst %.d, %.o, \$$(DEPENDENCIES))$${NEW_LINE}\ - SOURCES_DIRS:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -mindepth 1 -type d)$${NEW_LINE}\ - OBJECTS_DIRS:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%, %/, \$$(SOURCES_DIRS))$${NEW_LINE}\ - OBJECTS_DIRS_MAKEFILES:= \$$(patsubst %, %makefile, \$$(OBJECTS_DIRS))$${NEW_LINE}\ - $${NEW_LINE}\ - .PHONY: all$${NEW_LINE}\ - .PRECIOUS: \$$(DEPENDECIES) \$$(OBJECTS_DIRS_MAKEFILES)$${NEW_LINE}\ - $${NEW_LINE}\ - all: \$$(OBJECTS_DIRS) \$$(OBJECTS)$${NEW_LINE}\ - $${NEW_LINE}\ - %.d: makefile$${NEW_LINE}\ - @echo \"\\$${NEW_LINE}\ - \$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\") = \\$$\$$(shell (\\$$\$$(CXX) -M \\$$\$$(CXXFLAGS) \$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) 2>/dev/null || echo \\\"\$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) FORCE\\\") | sed \\\"s/.*://g;s/\\\\\\\\\\\\\\\\//g\\\")\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \$$(patsubst %.d,%.o, \$$@): \\$$\$$(\$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\")) makefile\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \\$$\$$(CXX) \\$$\$$(CXXFLAGS) \\$$\$$< -o \$$(patsubst %.d,%.o, \$$@)\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \" > \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/makefile: makefile$${NEW_LINE}\ - mkdir -p \$$(dir \$$@)$${NEW_LINE}\ - cp makefile \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/: FORCE | %/makefile$${NEW_LINE}\ - @accesstime=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - \$$(MAKE) -C \$$@ SRCDIR=\$$(SRCDIR)\$$(notdir \$$(patsubst %/, %, \$$@))/ OBJECTS_BASE_DIR=\$$(OBJECTS_BASE_DIR) SOURCES_BASE_DIR=\$$(SOURCES_BASE_DIR) CXX_OTHER_FLAGS=\"\$$(CXX_OTHER_FLAGS)\" && \\$${NEW_LINE}\ - accesstime2=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - if [ "\$$\$$accesstime" -ne "\$$\$$accesstime2" ]; then \\$${NEW_LINE}\ - touch .; \\$${NEW_LINE}\ - fi$${NEW_LINE}\ - $${NEW_LINE}\ - FORCE:$${NEW_LINE}\ - $${NEW_LINE}\ - -include \$$(DEPENDENCIES)" > $@ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# final lib/bin construction - -lib-debug/$(FULL_LIBRARY): $(OBJECTS_DEBUG) obj-debug/ - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG) - -lib-release/$(FULL_LIBRARY): $(OBJECTS_RELEASE) obj-release/ - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE) - -test-bin-debug/$(TESTBIN): $(TEST_OBJECTS_DEBUG) test-obj-debug/ - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(TEST_OBJECTS_DEBUG) -o $@ $(TEST_LDFLAGS_DEBUG) - -test-bin-release/$(TESTBIN): $(TEST_OBJECTS_RELEASE) test-obj-release/ - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(TEST_OBJECTS_RELEASE) -o $@ $(TEST_LDFLAGS_RELEASE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# subdir make calls - -obj-debug/: FORCE obj-debug/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-debug) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-g -Og -DDEBUG" - -obj-release/: FORCE obj-release/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-release) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-O3 -DNDEBUG -DRELEASE $(LTO_PARAM)" - -test-obj-debug/: FORCE test-obj-debug/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath test-obj-debug) SOURCES_BASE_DIR=$(realpath test-src) CXX_OTHER_FLAGS="-g -Og -DDEBUG" - -test-obj-release/: FORCE test-obj-release/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath test-obj-release) SOURCES_BASE_DIR=$(realpath test-src) CXX_OTHER_FLAGS="-O3 -DNDEBUG -DRELEASE $(LTO_PARAM)" - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# objects dependencies - -$(OBJECTS_DEBUG): obj-debug/ - -$(OBJECTS_RELEASE): obj-release/ - -$(TEST_OBJECTS_DEBUG): test-obj-debug/ - -$(TEST_OBJECTS_RELEASE): test-obj-release/ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# standalone main targets - -test-unit-debug: - LD_LIBRARY_PATH="$(subst $(space),,$(addsuffix lib-debug:,$(LINK_PATHS)))lib-debug" test-bin-debug/$(TESTBIN) - -test-unit-release: - LD_LIBRARY_PATH="$(subst $(space),,$(addsuffix lib-release:,$(LINK_PATHS)))lib-release" test-bin-release/$(TESTBIN) - -build-test-debug: test-bin-debug/$(TESTBIN) - -build-test-release: test-bin-release/$(TESTBIN) - -build-code-debug: lib-debug/$(FULL_LIBRARY) - -build-code-release: lib-release/$(FULL_LIBRARY) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# do all main targets - -debug: - $(MAKE) build-code-debug - $(MAKE) build-test-debug - $(MAKE) test-unit-debug - -release: - $(MAKE) build-code-release - $(MAKE) build-test-release - $(MAKE) test-unit-release - -clean: clean-debug clean-release - $(RM) -r doc - -clean-debug: - if [ -L obj-debug ]; then\ - $(RM) -r `readlink obj-debug`;\ - fi - if [ -L lib-debug ]; then\ - $(RM) -r `readlink lib-debug`;\ - fi - if [ -L test-obj-debug ]; then\ - $(RM) -r `readlink test-obj-debug`;\ - fi - if [ -L test-bin-debug ]; then\ - $(RM) -r `readlink test-bin-debug`;\ - fi - $(RM) -r *.o *.d lib-debug obj-debug test-bin-debug test-obj-debug CppUnitTestResults.xml - -clean-release: - if [ -L obj-release ]; then\ - $(RM) -r `readlink obj-release`;\ - fi - if [ -L lib-release ]; then\ - $(RM) -r `readlink lib-release`;\ - fi - if [ -L test-obj-release ]; then\ - $(RM) -r `readlink test-obj-release`;\ - fi - if [ -L test-bin-release ]; then\ - $(RM) -r `readlink test-bin-release`;\ - fi - $(RM) -r *.o *.d lib-release obj-release test-bin-release test-obj-release CppUnitTestResults.xml - -doc: - doxygen +-include ../build.conf +-include ../makefile-library diff --git a/alib2common/makefile b/alib2common/makefile index c11946de9e..0b88694038 100644 --- a/alib2common/makefile +++ b/alib2common/makefile @@ -1,239 +1,3 @@ -SHELL:=/bin/bash - --include ../build.conf -include makefile.conf - -LTO_PARAM:= -ifeq ($(USE_LTO),1) -LTO_PARAM:= -flto -endif - -FULL_LIBRARY:=lib$(LIBRARY).so -define NEW_LINE - - -endef - -export NEW_LINE - -CXX_FLAGS := -Wall -pedantic -Wextra -Werror -Wshadow -Wpointer-arith -Wcast-qual -Wdelete-non-virtual-dtor -Wredundant-decls - -space := $(eval) $(eval) - -LDFLAGS_DEBUG:=-rdynamic -shared -TEST_LDFLAGS_DEBUG:=-Wl,--no-as-needed -Llib-debug $(addprefix -L, $(addsuffix lib-debug, $(LINK_PATHS))) -rdynamic -l$(LIBRARY) $(addprefix -l, $(LINK_LIBRARIES)) -lcppunit -Wl,-rpath,. - -LDFLAGS_RELEASE:=-rdynamic -shared $(LTO_PARAM) -TEST_LDFLAGS_RELEASE:=-Wl,--no-as-needed -Llib-release $(addprefix -L, $(addsuffix lib-release, $(LINK_PATHS))) -rdynamic -l$(LIBRARY) $(addprefix -l, $(LINK_LIBRARIES)) -lcppunit $(LTO_PARAM) -Wl,-rpath,. - -OBJECTS_DEBUG:=$(patsubst src/%.cpp,obj-debug/%.o, $(shell find src/ -name *cpp)) -TEST_OBJECTS_DEBUG:=$(patsubst test-src/%.cpp,test-obj-debug/%.o, $(shell find test-src/ -name *cpp)) - -OBJECTS_RELEASE:=$(patsubst src/%.cpp,obj-release/%.o, $(filter-out $(wildcard src/debug/*), $(shell find src/ -name *cpp))) -TEST_OBJECTS_RELEASE:=$(patsubst test-src/%.cpp,test-obj-release/%.o, $(shell find test-src/ -name *cpp)) - -.PHONY: all debug release clean build-debug build-release clean-debug clean-release doc - -all: - @echo "What to do master?" - -FORCE: - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# make subdir makefile - -%/makefile: makefile makefile.conf - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - echo "\ - SHELL:=/bin/bash$${NEW_LINE}\ - SRCDIR:=$${NEW_LINE}\ - $${NEW_LINE}\ - define NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - $${NEW_LINE}\ - endef$${NEW_LINE}\ - $${NEW_LINE}\ - export NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - CXXFLAGS:= -pipe -std=c++11 \$$(CXX_OTHER_FLAGS) -c $(CXX_FLAGS) -fPIC \$$(addprefix -I, \$$(realpath $(INCLUDE_PATHS))) -I\$$(realpath \$$(SOURCES_BASE_DIR)/../src/)$${NEW_LINE}\ - $${NEW_LINE}\ - SOURCES:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -type f -name \"*.cpp\")$${NEW_LINE}\ - DEPENDENCIES:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d, \$$(SOURCES))$${NEW_LINE}\ - OBJECTS:= \$$(patsubst %.d, %.o, \$$(DEPENDENCIES))$${NEW_LINE}\ - SOURCES_DIRS:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -mindepth 1 -type d)$${NEW_LINE}\ - OBJECTS_DIRS:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%, %/, \$$(SOURCES_DIRS))$${NEW_LINE}\ - OBJECTS_DIRS_MAKEFILES:= \$$(patsubst %, %makefile, \$$(OBJECTS_DIRS))$${NEW_LINE}\ - $${NEW_LINE}\ - .PHONY: all$${NEW_LINE}\ - .PRECIOUS: \$$(DEPENDECIES) \$$(OBJECTS_DIRS_MAKEFILES)$${NEW_LINE}\ - $${NEW_LINE}\ - all: \$$(OBJECTS_DIRS) \$$(OBJECTS)$${NEW_LINE}\ - $${NEW_LINE}\ - %.d: makefile$${NEW_LINE}\ - @echo \"\\$${NEW_LINE}\ - \$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\") = \\$$\$$(shell (\\$$\$$(CXX) -M \\$$\$$(CXXFLAGS) \$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) 2>/dev/null || echo \\\"\$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) FORCE\\\") | sed \\\"s/.*://g;s/\\\\\\\\\\\\\\\\//g\\\")\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \$$(patsubst %.d,%.o, \$$@): \\$$\$$(\$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\")) makefile\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \\$$\$$(CXX) \\$$\$$(CXXFLAGS) \\$$\$$< -o \$$(patsubst %.d,%.o, \$$@)\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \" > \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/makefile: makefile$${NEW_LINE}\ - mkdir -p \$$(dir \$$@)$${NEW_LINE}\ - cp makefile \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/: FORCE | %/makefile$${NEW_LINE}\ - @accesstime=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - \$$(MAKE) -C \$$@ SRCDIR=\$$(SRCDIR)\$$(notdir \$$(patsubst %/, %, \$$@))/ OBJECTS_BASE_DIR=\$$(OBJECTS_BASE_DIR) SOURCES_BASE_DIR=\$$(SOURCES_BASE_DIR) CXX_OTHER_FLAGS=\"\$$(CXX_OTHER_FLAGS)\" && \\$${NEW_LINE}\ - accesstime2=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - if [ "\$$\$$accesstime" -ne "\$$\$$accesstime2" ]; then \\$${NEW_LINE}\ - touch .; \\$${NEW_LINE}\ - fi$${NEW_LINE}\ - $${NEW_LINE}\ - FORCE:$${NEW_LINE}\ - $${NEW_LINE}\ - -include \$$(DEPENDENCIES)" > $@ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# final lib/bin construction - -lib-debug/$(FULL_LIBRARY): $(OBJECTS_DEBUG) obj-debug/ - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG) - -lib-release/$(FULL_LIBRARY): $(OBJECTS_RELEASE) obj-release/ - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE) - -test-bin-debug/$(TESTBIN): $(TEST_OBJECTS_DEBUG) test-obj-debug/ - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(TEST_OBJECTS_DEBUG) -o $@ $(TEST_LDFLAGS_DEBUG) - -test-bin-release/$(TESTBIN): $(TEST_OBJECTS_RELEASE) test-obj-release/ - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(TEST_OBJECTS_RELEASE) -o $@ $(TEST_LDFLAGS_RELEASE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# subdir make calls - -obj-debug/: FORCE obj-debug/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-debug) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-g -Og -DDEBUG" - -obj-release/: FORCE obj-release/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-release) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-O3 -DNDEBUG -DRELEASE $(LTO_PARAM)" - -test-obj-debug/: FORCE test-obj-debug/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath test-obj-debug) SOURCES_BASE_DIR=$(realpath test-src) CXX_OTHER_FLAGS="-g -Og -DDEBUG" - -test-obj-release/: FORCE test-obj-release/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath test-obj-release) SOURCES_BASE_DIR=$(realpath test-src) CXX_OTHER_FLAGS="-O3 -DNDEBUG -DRELEASE $(LTO_PARAM)" - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# objects dependencies - -$(OBJECTS_DEBUG): obj-debug/ - -$(OBJECTS_RELEASE): obj-release/ - -$(TEST_OBJECTS_DEBUG): test-obj-debug/ - -$(TEST_OBJECTS_RELEASE): test-obj-release/ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# standalone main targets - -test-unit-debug: - LD_LIBRARY_PATH="$(subst $(space),,$(addsuffix lib-debug:,$(LINK_PATHS)))lib-debug" test-bin-debug/$(TESTBIN) - -test-unit-release: - LD_LIBRARY_PATH="$(subst $(space),,$(addsuffix lib-release:,$(LINK_PATHS)))lib-release" test-bin-release/$(TESTBIN) - -build-test-debug: test-bin-debug/$(TESTBIN) - -build-test-release: test-bin-release/$(TESTBIN) - -build-code-debug: lib-debug/$(FULL_LIBRARY) - -build-code-release: lib-release/$(FULL_LIBRARY) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# do all main targets - -debug: - $(MAKE) build-code-debug - $(MAKE) build-test-debug - $(MAKE) test-unit-debug - -release: - $(MAKE) build-code-release - $(MAKE) build-test-release - $(MAKE) test-unit-release - -clean: clean-debug clean-release - $(RM) -r doc - -clean-debug: - if [ -L obj-debug ]; then\ - $(RM) -r `readlink obj-debug`;\ - fi - if [ -L lib-debug ]; then\ - $(RM) -r `readlink lib-debug`;\ - fi - if [ -L test-obj-debug ]; then\ - $(RM) -r `readlink test-obj-debug`;\ - fi - if [ -L test-bin-debug ]; then\ - $(RM) -r `readlink test-bin-debug`;\ - fi - $(RM) -r *.o *.d lib-debug obj-debug test-bin-debug test-obj-debug CppUnitTestResults.xml - -clean-release: - if [ -L obj-release ]; then\ - $(RM) -r `readlink obj-release`;\ - fi - if [ -L lib-release ]; then\ - $(RM) -r `readlink lib-release`;\ - fi - if [ -L test-obj-release ]; then\ - $(RM) -r `readlink test-obj-release`;\ - fi - if [ -L test-bin-release ]; then\ - $(RM) -r `readlink test-bin-release`;\ - fi - $(RM) -r *.o *.d lib-release obj-release test-bin-release test-obj-release CppUnitTestResults.xml - -doc: - doxygen +-include ../build.conf +-include ../makefile-library diff --git a/alib2common/test-src/measurements/MeasurementsTest.cpp b/alib2common/test-src/measurements/MeasurementsTest.cpp index 71d33b9568..8eb74f3d7d 100644 --- a/alib2common/test-src/measurements/MeasurementsTest.cpp +++ b/alib2common/test-src/measurements/MeasurementsTest.cpp @@ -80,7 +80,13 @@ void MeasurementsTest::testTimeMeasurements ( ) { std::cout << measurements::MeasurementFormat::XML << measurements::results ( ) << std::endl; } -void MeasurementsTest::testMemoryMeasurements ( ) { +#ifdef __clang__ +#define __NO_OPTIMIZE_ATTRIBUTE__ __attribute__((optnone)) +#else +#define __NO_OPTIMIZE_ATTRIBUTE__ __attribute__((optimize("O0"))) +#endif + +void __NO_OPTIMIZE_ATTRIBUTE__ MeasurementsTest::testMemoryMeasurements ( ) { measurements::start ( "chunk1", measurements::Type::MAIN ); int * baz = new int[500]; diff --git a/alib2data/makefile b/alib2data/makefile index c11946de9e..0b88694038 100644 --- a/alib2data/makefile +++ b/alib2data/makefile @@ -1,239 +1,3 @@ -SHELL:=/bin/bash - --include ../build.conf -include makefile.conf - -LTO_PARAM:= -ifeq ($(USE_LTO),1) -LTO_PARAM:= -flto -endif - -FULL_LIBRARY:=lib$(LIBRARY).so -define NEW_LINE - - -endef - -export NEW_LINE - -CXX_FLAGS := -Wall -pedantic -Wextra -Werror -Wshadow -Wpointer-arith -Wcast-qual -Wdelete-non-virtual-dtor -Wredundant-decls - -space := $(eval) $(eval) - -LDFLAGS_DEBUG:=-rdynamic -shared -TEST_LDFLAGS_DEBUG:=-Wl,--no-as-needed -Llib-debug $(addprefix -L, $(addsuffix lib-debug, $(LINK_PATHS))) -rdynamic -l$(LIBRARY) $(addprefix -l, $(LINK_LIBRARIES)) -lcppunit -Wl,-rpath,. - -LDFLAGS_RELEASE:=-rdynamic -shared $(LTO_PARAM) -TEST_LDFLAGS_RELEASE:=-Wl,--no-as-needed -Llib-release $(addprefix -L, $(addsuffix lib-release, $(LINK_PATHS))) -rdynamic -l$(LIBRARY) $(addprefix -l, $(LINK_LIBRARIES)) -lcppunit $(LTO_PARAM) -Wl,-rpath,. - -OBJECTS_DEBUG:=$(patsubst src/%.cpp,obj-debug/%.o, $(shell find src/ -name *cpp)) -TEST_OBJECTS_DEBUG:=$(patsubst test-src/%.cpp,test-obj-debug/%.o, $(shell find test-src/ -name *cpp)) - -OBJECTS_RELEASE:=$(patsubst src/%.cpp,obj-release/%.o, $(filter-out $(wildcard src/debug/*), $(shell find src/ -name *cpp))) -TEST_OBJECTS_RELEASE:=$(patsubst test-src/%.cpp,test-obj-release/%.o, $(shell find test-src/ -name *cpp)) - -.PHONY: all debug release clean build-debug build-release clean-debug clean-release doc - -all: - @echo "What to do master?" - -FORCE: - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# make subdir makefile - -%/makefile: makefile makefile.conf - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - echo "\ - SHELL:=/bin/bash$${NEW_LINE}\ - SRCDIR:=$${NEW_LINE}\ - $${NEW_LINE}\ - define NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - $${NEW_LINE}\ - endef$${NEW_LINE}\ - $${NEW_LINE}\ - export NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - CXXFLAGS:= -pipe -std=c++11 \$$(CXX_OTHER_FLAGS) -c $(CXX_FLAGS) -fPIC \$$(addprefix -I, \$$(realpath $(INCLUDE_PATHS))) -I\$$(realpath \$$(SOURCES_BASE_DIR)/../src/)$${NEW_LINE}\ - $${NEW_LINE}\ - SOURCES:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -type f -name \"*.cpp\")$${NEW_LINE}\ - DEPENDENCIES:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d, \$$(SOURCES))$${NEW_LINE}\ - OBJECTS:= \$$(patsubst %.d, %.o, \$$(DEPENDENCIES))$${NEW_LINE}\ - SOURCES_DIRS:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -mindepth 1 -type d)$${NEW_LINE}\ - OBJECTS_DIRS:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%, %/, \$$(SOURCES_DIRS))$${NEW_LINE}\ - OBJECTS_DIRS_MAKEFILES:= \$$(patsubst %, %makefile, \$$(OBJECTS_DIRS))$${NEW_LINE}\ - $${NEW_LINE}\ - .PHONY: all$${NEW_LINE}\ - .PRECIOUS: \$$(DEPENDECIES) \$$(OBJECTS_DIRS_MAKEFILES)$${NEW_LINE}\ - $${NEW_LINE}\ - all: \$$(OBJECTS_DIRS) \$$(OBJECTS)$${NEW_LINE}\ - $${NEW_LINE}\ - %.d: makefile$${NEW_LINE}\ - @echo \"\\$${NEW_LINE}\ - \$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\") = \\$$\$$(shell (\\$$\$$(CXX) -M \\$$\$$(CXXFLAGS) \$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) 2>/dev/null || echo \\\"\$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) FORCE\\\") | sed \\\"s/.*://g;s/\\\\\\\\\\\\\\\\//g\\\")\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \$$(patsubst %.d,%.o, \$$@): \\$$\$$(\$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\")) makefile\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \\$$\$$(CXX) \\$$\$$(CXXFLAGS) \\$$\$$< -o \$$(patsubst %.d,%.o, \$$@)\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \" > \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/makefile: makefile$${NEW_LINE}\ - mkdir -p \$$(dir \$$@)$${NEW_LINE}\ - cp makefile \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/: FORCE | %/makefile$${NEW_LINE}\ - @accesstime=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - \$$(MAKE) -C \$$@ SRCDIR=\$$(SRCDIR)\$$(notdir \$$(patsubst %/, %, \$$@))/ OBJECTS_BASE_DIR=\$$(OBJECTS_BASE_DIR) SOURCES_BASE_DIR=\$$(SOURCES_BASE_DIR) CXX_OTHER_FLAGS=\"\$$(CXX_OTHER_FLAGS)\" && \\$${NEW_LINE}\ - accesstime2=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - if [ "\$$\$$accesstime" -ne "\$$\$$accesstime2" ]; then \\$${NEW_LINE}\ - touch .; \\$${NEW_LINE}\ - fi$${NEW_LINE}\ - $${NEW_LINE}\ - FORCE:$${NEW_LINE}\ - $${NEW_LINE}\ - -include \$$(DEPENDENCIES)" > $@ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# final lib/bin construction - -lib-debug/$(FULL_LIBRARY): $(OBJECTS_DEBUG) obj-debug/ - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG) - -lib-release/$(FULL_LIBRARY): $(OBJECTS_RELEASE) obj-release/ - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE) - -test-bin-debug/$(TESTBIN): $(TEST_OBJECTS_DEBUG) test-obj-debug/ - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(TEST_OBJECTS_DEBUG) -o $@ $(TEST_LDFLAGS_DEBUG) - -test-bin-release/$(TESTBIN): $(TEST_OBJECTS_RELEASE) test-obj-release/ - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(TEST_OBJECTS_RELEASE) -o $@ $(TEST_LDFLAGS_RELEASE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# subdir make calls - -obj-debug/: FORCE obj-debug/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-debug) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-g -Og -DDEBUG" - -obj-release/: FORCE obj-release/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-release) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-O3 -DNDEBUG -DRELEASE $(LTO_PARAM)" - -test-obj-debug/: FORCE test-obj-debug/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath test-obj-debug) SOURCES_BASE_DIR=$(realpath test-src) CXX_OTHER_FLAGS="-g -Og -DDEBUG" - -test-obj-release/: FORCE test-obj-release/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath test-obj-release) SOURCES_BASE_DIR=$(realpath test-src) CXX_OTHER_FLAGS="-O3 -DNDEBUG -DRELEASE $(LTO_PARAM)" - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# objects dependencies - -$(OBJECTS_DEBUG): obj-debug/ - -$(OBJECTS_RELEASE): obj-release/ - -$(TEST_OBJECTS_DEBUG): test-obj-debug/ - -$(TEST_OBJECTS_RELEASE): test-obj-release/ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# standalone main targets - -test-unit-debug: - LD_LIBRARY_PATH="$(subst $(space),,$(addsuffix lib-debug:,$(LINK_PATHS)))lib-debug" test-bin-debug/$(TESTBIN) - -test-unit-release: - LD_LIBRARY_PATH="$(subst $(space),,$(addsuffix lib-release:,$(LINK_PATHS)))lib-release" test-bin-release/$(TESTBIN) - -build-test-debug: test-bin-debug/$(TESTBIN) - -build-test-release: test-bin-release/$(TESTBIN) - -build-code-debug: lib-debug/$(FULL_LIBRARY) - -build-code-release: lib-release/$(FULL_LIBRARY) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# do all main targets - -debug: - $(MAKE) build-code-debug - $(MAKE) build-test-debug - $(MAKE) test-unit-debug - -release: - $(MAKE) build-code-release - $(MAKE) build-test-release - $(MAKE) test-unit-release - -clean: clean-debug clean-release - $(RM) -r doc - -clean-debug: - if [ -L obj-debug ]; then\ - $(RM) -r `readlink obj-debug`;\ - fi - if [ -L lib-debug ]; then\ - $(RM) -r `readlink lib-debug`;\ - fi - if [ -L test-obj-debug ]; then\ - $(RM) -r `readlink test-obj-debug`;\ - fi - if [ -L test-bin-debug ]; then\ - $(RM) -r `readlink test-bin-debug`;\ - fi - $(RM) -r *.o *.d lib-debug obj-debug test-bin-debug test-obj-debug CppUnitTestResults.xml - -clean-release: - if [ -L obj-release ]; then\ - $(RM) -r `readlink obj-release`;\ - fi - if [ -L lib-release ]; then\ - $(RM) -r `readlink lib-release`;\ - fi - if [ -L test-obj-release ]; then\ - $(RM) -r `readlink test-obj-release`;\ - fi - if [ -L test-bin-release ]; then\ - $(RM) -r `readlink test-bin-release`;\ - fi - $(RM) -r *.o *.d lib-release obj-release test-bin-release test-obj-release CppUnitTestResults.xml - -doc: - doxygen +-include ../build.conf +-include ../makefile-library diff --git a/alib2data_experimental/makefile b/alib2data_experimental/makefile index c11946de9e..0b88694038 100644 --- a/alib2data_experimental/makefile +++ b/alib2data_experimental/makefile @@ -1,239 +1,3 @@ -SHELL:=/bin/bash - --include ../build.conf -include makefile.conf - -LTO_PARAM:= -ifeq ($(USE_LTO),1) -LTO_PARAM:= -flto -endif - -FULL_LIBRARY:=lib$(LIBRARY).so -define NEW_LINE - - -endef - -export NEW_LINE - -CXX_FLAGS := -Wall -pedantic -Wextra -Werror -Wshadow -Wpointer-arith -Wcast-qual -Wdelete-non-virtual-dtor -Wredundant-decls - -space := $(eval) $(eval) - -LDFLAGS_DEBUG:=-rdynamic -shared -TEST_LDFLAGS_DEBUG:=-Wl,--no-as-needed -Llib-debug $(addprefix -L, $(addsuffix lib-debug, $(LINK_PATHS))) -rdynamic -l$(LIBRARY) $(addprefix -l, $(LINK_LIBRARIES)) -lcppunit -Wl,-rpath,. - -LDFLAGS_RELEASE:=-rdynamic -shared $(LTO_PARAM) -TEST_LDFLAGS_RELEASE:=-Wl,--no-as-needed -Llib-release $(addprefix -L, $(addsuffix lib-release, $(LINK_PATHS))) -rdynamic -l$(LIBRARY) $(addprefix -l, $(LINK_LIBRARIES)) -lcppunit $(LTO_PARAM) -Wl,-rpath,. - -OBJECTS_DEBUG:=$(patsubst src/%.cpp,obj-debug/%.o, $(shell find src/ -name *cpp)) -TEST_OBJECTS_DEBUG:=$(patsubst test-src/%.cpp,test-obj-debug/%.o, $(shell find test-src/ -name *cpp)) - -OBJECTS_RELEASE:=$(patsubst src/%.cpp,obj-release/%.o, $(filter-out $(wildcard src/debug/*), $(shell find src/ -name *cpp))) -TEST_OBJECTS_RELEASE:=$(patsubst test-src/%.cpp,test-obj-release/%.o, $(shell find test-src/ -name *cpp)) - -.PHONY: all debug release clean build-debug build-release clean-debug clean-release doc - -all: - @echo "What to do master?" - -FORCE: - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# make subdir makefile - -%/makefile: makefile makefile.conf - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - echo "\ - SHELL:=/bin/bash$${NEW_LINE}\ - SRCDIR:=$${NEW_LINE}\ - $${NEW_LINE}\ - define NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - $${NEW_LINE}\ - endef$${NEW_LINE}\ - $${NEW_LINE}\ - export NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - CXXFLAGS:= -pipe -std=c++11 \$$(CXX_OTHER_FLAGS) -c $(CXX_FLAGS) -fPIC \$$(addprefix -I, \$$(realpath $(INCLUDE_PATHS))) -I\$$(realpath \$$(SOURCES_BASE_DIR)/../src/)$${NEW_LINE}\ - $${NEW_LINE}\ - SOURCES:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -type f -name \"*.cpp\")$${NEW_LINE}\ - DEPENDENCIES:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d, \$$(SOURCES))$${NEW_LINE}\ - OBJECTS:= \$$(patsubst %.d, %.o, \$$(DEPENDENCIES))$${NEW_LINE}\ - SOURCES_DIRS:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -mindepth 1 -type d)$${NEW_LINE}\ - OBJECTS_DIRS:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%, %/, \$$(SOURCES_DIRS))$${NEW_LINE}\ - OBJECTS_DIRS_MAKEFILES:= \$$(patsubst %, %makefile, \$$(OBJECTS_DIRS))$${NEW_LINE}\ - $${NEW_LINE}\ - .PHONY: all$${NEW_LINE}\ - .PRECIOUS: \$$(DEPENDECIES) \$$(OBJECTS_DIRS_MAKEFILES)$${NEW_LINE}\ - $${NEW_LINE}\ - all: \$$(OBJECTS_DIRS) \$$(OBJECTS)$${NEW_LINE}\ - $${NEW_LINE}\ - %.d: makefile$${NEW_LINE}\ - @echo \"\\$${NEW_LINE}\ - \$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\") = \\$$\$$(shell (\\$$\$$(CXX) -M \\$$\$$(CXXFLAGS) \$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) 2>/dev/null || echo \\\"\$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) FORCE\\\") | sed \\\"s/.*://g;s/\\\\\\\\\\\\\\\\//g\\\")\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \$$(patsubst %.d,%.o, \$$@): \\$$\$$(\$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\")) makefile\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \\$$\$$(CXX) \\$$\$$(CXXFLAGS) \\$$\$$< -o \$$(patsubst %.d,%.o, \$$@)\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \" > \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/makefile: makefile$${NEW_LINE}\ - mkdir -p \$$(dir \$$@)$${NEW_LINE}\ - cp makefile \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/: FORCE | %/makefile$${NEW_LINE}\ - @accesstime=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - \$$(MAKE) -C \$$@ SRCDIR=\$$(SRCDIR)\$$(notdir \$$(patsubst %/, %, \$$@))/ OBJECTS_BASE_DIR=\$$(OBJECTS_BASE_DIR) SOURCES_BASE_DIR=\$$(SOURCES_BASE_DIR) CXX_OTHER_FLAGS=\"\$$(CXX_OTHER_FLAGS)\" && \\$${NEW_LINE}\ - accesstime2=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - if [ "\$$\$$accesstime" -ne "\$$\$$accesstime2" ]; then \\$${NEW_LINE}\ - touch .; \\$${NEW_LINE}\ - fi$${NEW_LINE}\ - $${NEW_LINE}\ - FORCE:$${NEW_LINE}\ - $${NEW_LINE}\ - -include \$$(DEPENDENCIES)" > $@ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# final lib/bin construction - -lib-debug/$(FULL_LIBRARY): $(OBJECTS_DEBUG) obj-debug/ - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG) - -lib-release/$(FULL_LIBRARY): $(OBJECTS_RELEASE) obj-release/ - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE) - -test-bin-debug/$(TESTBIN): $(TEST_OBJECTS_DEBUG) test-obj-debug/ - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(TEST_OBJECTS_DEBUG) -o $@ $(TEST_LDFLAGS_DEBUG) - -test-bin-release/$(TESTBIN): $(TEST_OBJECTS_RELEASE) test-obj-release/ - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(TEST_OBJECTS_RELEASE) -o $@ $(TEST_LDFLAGS_RELEASE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# subdir make calls - -obj-debug/: FORCE obj-debug/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-debug) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-g -Og -DDEBUG" - -obj-release/: FORCE obj-release/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-release) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-O3 -DNDEBUG -DRELEASE $(LTO_PARAM)" - -test-obj-debug/: FORCE test-obj-debug/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath test-obj-debug) SOURCES_BASE_DIR=$(realpath test-src) CXX_OTHER_FLAGS="-g -Og -DDEBUG" - -test-obj-release/: FORCE test-obj-release/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath test-obj-release) SOURCES_BASE_DIR=$(realpath test-src) CXX_OTHER_FLAGS="-O3 -DNDEBUG -DRELEASE $(LTO_PARAM)" - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# objects dependencies - -$(OBJECTS_DEBUG): obj-debug/ - -$(OBJECTS_RELEASE): obj-release/ - -$(TEST_OBJECTS_DEBUG): test-obj-debug/ - -$(TEST_OBJECTS_RELEASE): test-obj-release/ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# standalone main targets - -test-unit-debug: - LD_LIBRARY_PATH="$(subst $(space),,$(addsuffix lib-debug:,$(LINK_PATHS)))lib-debug" test-bin-debug/$(TESTBIN) - -test-unit-release: - LD_LIBRARY_PATH="$(subst $(space),,$(addsuffix lib-release:,$(LINK_PATHS)))lib-release" test-bin-release/$(TESTBIN) - -build-test-debug: test-bin-debug/$(TESTBIN) - -build-test-release: test-bin-release/$(TESTBIN) - -build-code-debug: lib-debug/$(FULL_LIBRARY) - -build-code-release: lib-release/$(FULL_LIBRARY) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# do all main targets - -debug: - $(MAKE) build-code-debug - $(MAKE) build-test-debug - $(MAKE) test-unit-debug - -release: - $(MAKE) build-code-release - $(MAKE) build-test-release - $(MAKE) test-unit-release - -clean: clean-debug clean-release - $(RM) -r doc - -clean-debug: - if [ -L obj-debug ]; then\ - $(RM) -r `readlink obj-debug`;\ - fi - if [ -L lib-debug ]; then\ - $(RM) -r `readlink lib-debug`;\ - fi - if [ -L test-obj-debug ]; then\ - $(RM) -r `readlink test-obj-debug`;\ - fi - if [ -L test-bin-debug ]; then\ - $(RM) -r `readlink test-bin-debug`;\ - fi - $(RM) -r *.o *.d lib-debug obj-debug test-bin-debug test-obj-debug CppUnitTestResults.xml - -clean-release: - if [ -L obj-release ]; then\ - $(RM) -r `readlink obj-release`;\ - fi - if [ -L lib-release ]; then\ - $(RM) -r `readlink lib-release`;\ - fi - if [ -L test-obj-release ]; then\ - $(RM) -r `readlink test-obj-release`;\ - fi - if [ -L test-bin-release ]; then\ - $(RM) -r `readlink test-bin-release`;\ - fi - $(RM) -r *.o *.d lib-release obj-release test-bin-release test-obj-release CppUnitTestResults.xml - -doc: - doxygen +-include ../build.conf +-include ../makefile-library diff --git a/alib2elgo/makefile b/alib2elgo/makefile index c11946de9e..0b88694038 100644 --- a/alib2elgo/makefile +++ b/alib2elgo/makefile @@ -1,239 +1,3 @@ -SHELL:=/bin/bash - --include ../build.conf -include makefile.conf - -LTO_PARAM:= -ifeq ($(USE_LTO),1) -LTO_PARAM:= -flto -endif - -FULL_LIBRARY:=lib$(LIBRARY).so -define NEW_LINE - - -endef - -export NEW_LINE - -CXX_FLAGS := -Wall -pedantic -Wextra -Werror -Wshadow -Wpointer-arith -Wcast-qual -Wdelete-non-virtual-dtor -Wredundant-decls - -space := $(eval) $(eval) - -LDFLAGS_DEBUG:=-rdynamic -shared -TEST_LDFLAGS_DEBUG:=-Wl,--no-as-needed -Llib-debug $(addprefix -L, $(addsuffix lib-debug, $(LINK_PATHS))) -rdynamic -l$(LIBRARY) $(addprefix -l, $(LINK_LIBRARIES)) -lcppunit -Wl,-rpath,. - -LDFLAGS_RELEASE:=-rdynamic -shared $(LTO_PARAM) -TEST_LDFLAGS_RELEASE:=-Wl,--no-as-needed -Llib-release $(addprefix -L, $(addsuffix lib-release, $(LINK_PATHS))) -rdynamic -l$(LIBRARY) $(addprefix -l, $(LINK_LIBRARIES)) -lcppunit $(LTO_PARAM) -Wl,-rpath,. - -OBJECTS_DEBUG:=$(patsubst src/%.cpp,obj-debug/%.o, $(shell find src/ -name *cpp)) -TEST_OBJECTS_DEBUG:=$(patsubst test-src/%.cpp,test-obj-debug/%.o, $(shell find test-src/ -name *cpp)) - -OBJECTS_RELEASE:=$(patsubst src/%.cpp,obj-release/%.o, $(filter-out $(wildcard src/debug/*), $(shell find src/ -name *cpp))) -TEST_OBJECTS_RELEASE:=$(patsubst test-src/%.cpp,test-obj-release/%.o, $(shell find test-src/ -name *cpp)) - -.PHONY: all debug release clean build-debug build-release clean-debug clean-release doc - -all: - @echo "What to do master?" - -FORCE: - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# make subdir makefile - -%/makefile: makefile makefile.conf - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - echo "\ - SHELL:=/bin/bash$${NEW_LINE}\ - SRCDIR:=$${NEW_LINE}\ - $${NEW_LINE}\ - define NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - $${NEW_LINE}\ - endef$${NEW_LINE}\ - $${NEW_LINE}\ - export NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - CXXFLAGS:= -pipe -std=c++11 \$$(CXX_OTHER_FLAGS) -c $(CXX_FLAGS) -fPIC \$$(addprefix -I, \$$(realpath $(INCLUDE_PATHS))) -I\$$(realpath \$$(SOURCES_BASE_DIR)/../src/)$${NEW_LINE}\ - $${NEW_LINE}\ - SOURCES:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -type f -name \"*.cpp\")$${NEW_LINE}\ - DEPENDENCIES:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d, \$$(SOURCES))$${NEW_LINE}\ - OBJECTS:= \$$(patsubst %.d, %.o, \$$(DEPENDENCIES))$${NEW_LINE}\ - SOURCES_DIRS:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -mindepth 1 -type d)$${NEW_LINE}\ - OBJECTS_DIRS:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%, %/, \$$(SOURCES_DIRS))$${NEW_LINE}\ - OBJECTS_DIRS_MAKEFILES:= \$$(patsubst %, %makefile, \$$(OBJECTS_DIRS))$${NEW_LINE}\ - $${NEW_LINE}\ - .PHONY: all$${NEW_LINE}\ - .PRECIOUS: \$$(DEPENDECIES) \$$(OBJECTS_DIRS_MAKEFILES)$${NEW_LINE}\ - $${NEW_LINE}\ - all: \$$(OBJECTS_DIRS) \$$(OBJECTS)$${NEW_LINE}\ - $${NEW_LINE}\ - %.d: makefile$${NEW_LINE}\ - @echo \"\\$${NEW_LINE}\ - \$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\") = \\$$\$$(shell (\\$$\$$(CXX) -M \\$$\$$(CXXFLAGS) \$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) 2>/dev/null || echo \\\"\$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) FORCE\\\") | sed \\\"s/.*://g;s/\\\\\\\\\\\\\\\\//g\\\")\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \$$(patsubst %.d,%.o, \$$@): \\$$\$$(\$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\")) makefile\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \\$$\$$(CXX) \\$$\$$(CXXFLAGS) \\$$\$$< -o \$$(patsubst %.d,%.o, \$$@)\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \" > \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/makefile: makefile$${NEW_LINE}\ - mkdir -p \$$(dir \$$@)$${NEW_LINE}\ - cp makefile \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/: FORCE | %/makefile$${NEW_LINE}\ - @accesstime=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - \$$(MAKE) -C \$$@ SRCDIR=\$$(SRCDIR)\$$(notdir \$$(patsubst %/, %, \$$@))/ OBJECTS_BASE_DIR=\$$(OBJECTS_BASE_DIR) SOURCES_BASE_DIR=\$$(SOURCES_BASE_DIR) CXX_OTHER_FLAGS=\"\$$(CXX_OTHER_FLAGS)\" && \\$${NEW_LINE}\ - accesstime2=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - if [ "\$$\$$accesstime" -ne "\$$\$$accesstime2" ]; then \\$${NEW_LINE}\ - touch .; \\$${NEW_LINE}\ - fi$${NEW_LINE}\ - $${NEW_LINE}\ - FORCE:$${NEW_LINE}\ - $${NEW_LINE}\ - -include \$$(DEPENDENCIES)" > $@ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# final lib/bin construction - -lib-debug/$(FULL_LIBRARY): $(OBJECTS_DEBUG) obj-debug/ - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG) - -lib-release/$(FULL_LIBRARY): $(OBJECTS_RELEASE) obj-release/ - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE) - -test-bin-debug/$(TESTBIN): $(TEST_OBJECTS_DEBUG) test-obj-debug/ - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(TEST_OBJECTS_DEBUG) -o $@ $(TEST_LDFLAGS_DEBUG) - -test-bin-release/$(TESTBIN): $(TEST_OBJECTS_RELEASE) test-obj-release/ - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(TEST_OBJECTS_RELEASE) -o $@ $(TEST_LDFLAGS_RELEASE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# subdir make calls - -obj-debug/: FORCE obj-debug/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-debug) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-g -Og -DDEBUG" - -obj-release/: FORCE obj-release/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-release) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-O3 -DNDEBUG -DRELEASE $(LTO_PARAM)" - -test-obj-debug/: FORCE test-obj-debug/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath test-obj-debug) SOURCES_BASE_DIR=$(realpath test-src) CXX_OTHER_FLAGS="-g -Og -DDEBUG" - -test-obj-release/: FORCE test-obj-release/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath test-obj-release) SOURCES_BASE_DIR=$(realpath test-src) CXX_OTHER_FLAGS="-O3 -DNDEBUG -DRELEASE $(LTO_PARAM)" - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# objects dependencies - -$(OBJECTS_DEBUG): obj-debug/ - -$(OBJECTS_RELEASE): obj-release/ - -$(TEST_OBJECTS_DEBUG): test-obj-debug/ - -$(TEST_OBJECTS_RELEASE): test-obj-release/ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# standalone main targets - -test-unit-debug: - LD_LIBRARY_PATH="$(subst $(space),,$(addsuffix lib-debug:,$(LINK_PATHS)))lib-debug" test-bin-debug/$(TESTBIN) - -test-unit-release: - LD_LIBRARY_PATH="$(subst $(space),,$(addsuffix lib-release:,$(LINK_PATHS)))lib-release" test-bin-release/$(TESTBIN) - -build-test-debug: test-bin-debug/$(TESTBIN) - -build-test-release: test-bin-release/$(TESTBIN) - -build-code-debug: lib-debug/$(FULL_LIBRARY) - -build-code-release: lib-release/$(FULL_LIBRARY) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# do all main targets - -debug: - $(MAKE) build-code-debug - $(MAKE) build-test-debug - $(MAKE) test-unit-debug - -release: - $(MAKE) build-code-release - $(MAKE) build-test-release - $(MAKE) test-unit-release - -clean: clean-debug clean-release - $(RM) -r doc - -clean-debug: - if [ -L obj-debug ]; then\ - $(RM) -r `readlink obj-debug`;\ - fi - if [ -L lib-debug ]; then\ - $(RM) -r `readlink lib-debug`;\ - fi - if [ -L test-obj-debug ]; then\ - $(RM) -r `readlink test-obj-debug`;\ - fi - if [ -L test-bin-debug ]; then\ - $(RM) -r `readlink test-bin-debug`;\ - fi - $(RM) -r *.o *.d lib-debug obj-debug test-bin-debug test-obj-debug CppUnitTestResults.xml - -clean-release: - if [ -L obj-release ]; then\ - $(RM) -r `readlink obj-release`;\ - fi - if [ -L lib-release ]; then\ - $(RM) -r `readlink lib-release`;\ - fi - if [ -L test-obj-release ]; then\ - $(RM) -r `readlink test-obj-release`;\ - fi - if [ -L test-bin-release ]; then\ - $(RM) -r `readlink test-bin-release`;\ - fi - $(RM) -r *.o *.d lib-release obj-release test-bin-release test-obj-release CppUnitTestResults.xml - -doc: - doxygen +-include ../build.conf +-include ../makefile-library diff --git a/alib2measurepp/makefile b/alib2measurepp/makefile index c11946de9e..0b88694038 100644 --- a/alib2measurepp/makefile +++ b/alib2measurepp/makefile @@ -1,239 +1,3 @@ -SHELL:=/bin/bash - --include ../build.conf -include makefile.conf - -LTO_PARAM:= -ifeq ($(USE_LTO),1) -LTO_PARAM:= -flto -endif - -FULL_LIBRARY:=lib$(LIBRARY).so -define NEW_LINE - - -endef - -export NEW_LINE - -CXX_FLAGS := -Wall -pedantic -Wextra -Werror -Wshadow -Wpointer-arith -Wcast-qual -Wdelete-non-virtual-dtor -Wredundant-decls - -space := $(eval) $(eval) - -LDFLAGS_DEBUG:=-rdynamic -shared -TEST_LDFLAGS_DEBUG:=-Wl,--no-as-needed -Llib-debug $(addprefix -L, $(addsuffix lib-debug, $(LINK_PATHS))) -rdynamic -l$(LIBRARY) $(addprefix -l, $(LINK_LIBRARIES)) -lcppunit -Wl,-rpath,. - -LDFLAGS_RELEASE:=-rdynamic -shared $(LTO_PARAM) -TEST_LDFLAGS_RELEASE:=-Wl,--no-as-needed -Llib-release $(addprefix -L, $(addsuffix lib-release, $(LINK_PATHS))) -rdynamic -l$(LIBRARY) $(addprefix -l, $(LINK_LIBRARIES)) -lcppunit $(LTO_PARAM) -Wl,-rpath,. - -OBJECTS_DEBUG:=$(patsubst src/%.cpp,obj-debug/%.o, $(shell find src/ -name *cpp)) -TEST_OBJECTS_DEBUG:=$(patsubst test-src/%.cpp,test-obj-debug/%.o, $(shell find test-src/ -name *cpp)) - -OBJECTS_RELEASE:=$(patsubst src/%.cpp,obj-release/%.o, $(filter-out $(wildcard src/debug/*), $(shell find src/ -name *cpp))) -TEST_OBJECTS_RELEASE:=$(patsubst test-src/%.cpp,test-obj-release/%.o, $(shell find test-src/ -name *cpp)) - -.PHONY: all debug release clean build-debug build-release clean-debug clean-release doc - -all: - @echo "What to do master?" - -FORCE: - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# make subdir makefile - -%/makefile: makefile makefile.conf - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - echo "\ - SHELL:=/bin/bash$${NEW_LINE}\ - SRCDIR:=$${NEW_LINE}\ - $${NEW_LINE}\ - define NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - $${NEW_LINE}\ - endef$${NEW_LINE}\ - $${NEW_LINE}\ - export NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - CXXFLAGS:= -pipe -std=c++11 \$$(CXX_OTHER_FLAGS) -c $(CXX_FLAGS) -fPIC \$$(addprefix -I, \$$(realpath $(INCLUDE_PATHS))) -I\$$(realpath \$$(SOURCES_BASE_DIR)/../src/)$${NEW_LINE}\ - $${NEW_LINE}\ - SOURCES:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -type f -name \"*.cpp\")$${NEW_LINE}\ - DEPENDENCIES:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d, \$$(SOURCES))$${NEW_LINE}\ - OBJECTS:= \$$(patsubst %.d, %.o, \$$(DEPENDENCIES))$${NEW_LINE}\ - SOURCES_DIRS:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -mindepth 1 -type d)$${NEW_LINE}\ - OBJECTS_DIRS:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%, %/, \$$(SOURCES_DIRS))$${NEW_LINE}\ - OBJECTS_DIRS_MAKEFILES:= \$$(patsubst %, %makefile, \$$(OBJECTS_DIRS))$${NEW_LINE}\ - $${NEW_LINE}\ - .PHONY: all$${NEW_LINE}\ - .PRECIOUS: \$$(DEPENDECIES) \$$(OBJECTS_DIRS_MAKEFILES)$${NEW_LINE}\ - $${NEW_LINE}\ - all: \$$(OBJECTS_DIRS) \$$(OBJECTS)$${NEW_LINE}\ - $${NEW_LINE}\ - %.d: makefile$${NEW_LINE}\ - @echo \"\\$${NEW_LINE}\ - \$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\") = \\$$\$$(shell (\\$$\$$(CXX) -M \\$$\$$(CXXFLAGS) \$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) 2>/dev/null || echo \\\"\$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) FORCE\\\") | sed \\\"s/.*://g;s/\\\\\\\\\\\\\\\\//g\\\")\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \$$(patsubst %.d,%.o, \$$@): \\$$\$$(\$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\")) makefile\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \\$$\$$(CXX) \\$$\$$(CXXFLAGS) \\$$\$$< -o \$$(patsubst %.d,%.o, \$$@)\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \" > \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/makefile: makefile$${NEW_LINE}\ - mkdir -p \$$(dir \$$@)$${NEW_LINE}\ - cp makefile \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/: FORCE | %/makefile$${NEW_LINE}\ - @accesstime=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - \$$(MAKE) -C \$$@ SRCDIR=\$$(SRCDIR)\$$(notdir \$$(patsubst %/, %, \$$@))/ OBJECTS_BASE_DIR=\$$(OBJECTS_BASE_DIR) SOURCES_BASE_DIR=\$$(SOURCES_BASE_DIR) CXX_OTHER_FLAGS=\"\$$(CXX_OTHER_FLAGS)\" && \\$${NEW_LINE}\ - accesstime2=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - if [ "\$$\$$accesstime" -ne "\$$\$$accesstime2" ]; then \\$${NEW_LINE}\ - touch .; \\$${NEW_LINE}\ - fi$${NEW_LINE}\ - $${NEW_LINE}\ - FORCE:$${NEW_LINE}\ - $${NEW_LINE}\ - -include \$$(DEPENDENCIES)" > $@ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# final lib/bin construction - -lib-debug/$(FULL_LIBRARY): $(OBJECTS_DEBUG) obj-debug/ - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG) - -lib-release/$(FULL_LIBRARY): $(OBJECTS_RELEASE) obj-release/ - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE) - -test-bin-debug/$(TESTBIN): $(TEST_OBJECTS_DEBUG) test-obj-debug/ - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(TEST_OBJECTS_DEBUG) -o $@ $(TEST_LDFLAGS_DEBUG) - -test-bin-release/$(TESTBIN): $(TEST_OBJECTS_RELEASE) test-obj-release/ - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(TEST_OBJECTS_RELEASE) -o $@ $(TEST_LDFLAGS_RELEASE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# subdir make calls - -obj-debug/: FORCE obj-debug/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-debug) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-g -Og -DDEBUG" - -obj-release/: FORCE obj-release/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-release) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-O3 -DNDEBUG -DRELEASE $(LTO_PARAM)" - -test-obj-debug/: FORCE test-obj-debug/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath test-obj-debug) SOURCES_BASE_DIR=$(realpath test-src) CXX_OTHER_FLAGS="-g -Og -DDEBUG" - -test-obj-release/: FORCE test-obj-release/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath test-obj-release) SOURCES_BASE_DIR=$(realpath test-src) CXX_OTHER_FLAGS="-O3 -DNDEBUG -DRELEASE $(LTO_PARAM)" - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# objects dependencies - -$(OBJECTS_DEBUG): obj-debug/ - -$(OBJECTS_RELEASE): obj-release/ - -$(TEST_OBJECTS_DEBUG): test-obj-debug/ - -$(TEST_OBJECTS_RELEASE): test-obj-release/ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# standalone main targets - -test-unit-debug: - LD_LIBRARY_PATH="$(subst $(space),,$(addsuffix lib-debug:,$(LINK_PATHS)))lib-debug" test-bin-debug/$(TESTBIN) - -test-unit-release: - LD_LIBRARY_PATH="$(subst $(space),,$(addsuffix lib-release:,$(LINK_PATHS)))lib-release" test-bin-release/$(TESTBIN) - -build-test-debug: test-bin-debug/$(TESTBIN) - -build-test-release: test-bin-release/$(TESTBIN) - -build-code-debug: lib-debug/$(FULL_LIBRARY) - -build-code-release: lib-release/$(FULL_LIBRARY) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# do all main targets - -debug: - $(MAKE) build-code-debug - $(MAKE) build-test-debug - $(MAKE) test-unit-debug - -release: - $(MAKE) build-code-release - $(MAKE) build-test-release - $(MAKE) test-unit-release - -clean: clean-debug clean-release - $(RM) -r doc - -clean-debug: - if [ -L obj-debug ]; then\ - $(RM) -r `readlink obj-debug`;\ - fi - if [ -L lib-debug ]; then\ - $(RM) -r `readlink lib-debug`;\ - fi - if [ -L test-obj-debug ]; then\ - $(RM) -r `readlink test-obj-debug`;\ - fi - if [ -L test-bin-debug ]; then\ - $(RM) -r `readlink test-bin-debug`;\ - fi - $(RM) -r *.o *.d lib-debug obj-debug test-bin-debug test-obj-debug CppUnitTestResults.xml - -clean-release: - if [ -L obj-release ]; then\ - $(RM) -r `readlink obj-release`;\ - fi - if [ -L lib-release ]; then\ - $(RM) -r `readlink lib-release`;\ - fi - if [ -L test-obj-release ]; then\ - $(RM) -r `readlink test-obj-release`;\ - fi - if [ -L test-bin-release ]; then\ - $(RM) -r `readlink test-bin-release`;\ - fi - $(RM) -r *.o *.d lib-release obj-release test-bin-release test-obj-release CppUnitTestResults.xml - -doc: - doxygen +-include ../build.conf +-include ../makefile-library diff --git a/alib2raw/makefile b/alib2raw/makefile index c11946de9e..0b88694038 100644 --- a/alib2raw/makefile +++ b/alib2raw/makefile @@ -1,239 +1,3 @@ -SHELL:=/bin/bash - --include ../build.conf -include makefile.conf - -LTO_PARAM:= -ifeq ($(USE_LTO),1) -LTO_PARAM:= -flto -endif - -FULL_LIBRARY:=lib$(LIBRARY).so -define NEW_LINE - - -endef - -export NEW_LINE - -CXX_FLAGS := -Wall -pedantic -Wextra -Werror -Wshadow -Wpointer-arith -Wcast-qual -Wdelete-non-virtual-dtor -Wredundant-decls - -space := $(eval) $(eval) - -LDFLAGS_DEBUG:=-rdynamic -shared -TEST_LDFLAGS_DEBUG:=-Wl,--no-as-needed -Llib-debug $(addprefix -L, $(addsuffix lib-debug, $(LINK_PATHS))) -rdynamic -l$(LIBRARY) $(addprefix -l, $(LINK_LIBRARIES)) -lcppunit -Wl,-rpath,. - -LDFLAGS_RELEASE:=-rdynamic -shared $(LTO_PARAM) -TEST_LDFLAGS_RELEASE:=-Wl,--no-as-needed -Llib-release $(addprefix -L, $(addsuffix lib-release, $(LINK_PATHS))) -rdynamic -l$(LIBRARY) $(addprefix -l, $(LINK_LIBRARIES)) -lcppunit $(LTO_PARAM) -Wl,-rpath,. - -OBJECTS_DEBUG:=$(patsubst src/%.cpp,obj-debug/%.o, $(shell find src/ -name *cpp)) -TEST_OBJECTS_DEBUG:=$(patsubst test-src/%.cpp,test-obj-debug/%.o, $(shell find test-src/ -name *cpp)) - -OBJECTS_RELEASE:=$(patsubst src/%.cpp,obj-release/%.o, $(filter-out $(wildcard src/debug/*), $(shell find src/ -name *cpp))) -TEST_OBJECTS_RELEASE:=$(patsubst test-src/%.cpp,test-obj-release/%.o, $(shell find test-src/ -name *cpp)) - -.PHONY: all debug release clean build-debug build-release clean-debug clean-release doc - -all: - @echo "What to do master?" - -FORCE: - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# make subdir makefile - -%/makefile: makefile makefile.conf - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - echo "\ - SHELL:=/bin/bash$${NEW_LINE}\ - SRCDIR:=$${NEW_LINE}\ - $${NEW_LINE}\ - define NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - $${NEW_LINE}\ - endef$${NEW_LINE}\ - $${NEW_LINE}\ - export NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - CXXFLAGS:= -pipe -std=c++11 \$$(CXX_OTHER_FLAGS) -c $(CXX_FLAGS) -fPIC \$$(addprefix -I, \$$(realpath $(INCLUDE_PATHS))) -I\$$(realpath \$$(SOURCES_BASE_DIR)/../src/)$${NEW_LINE}\ - $${NEW_LINE}\ - SOURCES:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -type f -name \"*.cpp\")$${NEW_LINE}\ - DEPENDENCIES:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d, \$$(SOURCES))$${NEW_LINE}\ - OBJECTS:= \$$(patsubst %.d, %.o, \$$(DEPENDENCIES))$${NEW_LINE}\ - SOURCES_DIRS:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -mindepth 1 -type d)$${NEW_LINE}\ - OBJECTS_DIRS:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%, %/, \$$(SOURCES_DIRS))$${NEW_LINE}\ - OBJECTS_DIRS_MAKEFILES:= \$$(patsubst %, %makefile, \$$(OBJECTS_DIRS))$${NEW_LINE}\ - $${NEW_LINE}\ - .PHONY: all$${NEW_LINE}\ - .PRECIOUS: \$$(DEPENDECIES) \$$(OBJECTS_DIRS_MAKEFILES)$${NEW_LINE}\ - $${NEW_LINE}\ - all: \$$(OBJECTS_DIRS) \$$(OBJECTS)$${NEW_LINE}\ - $${NEW_LINE}\ - %.d: makefile$${NEW_LINE}\ - @echo \"\\$${NEW_LINE}\ - \$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\") = \\$$\$$(shell (\\$$\$$(CXX) -M \\$$\$$(CXXFLAGS) \$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) 2>/dev/null || echo \\\"\$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) FORCE\\\") | sed \\\"s/.*://g;s/\\\\\\\\\\\\\\\\//g\\\")\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \$$(patsubst %.d,%.o, \$$@): \\$$\$$(\$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\")) makefile\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \\$$\$$(CXX) \\$$\$$(CXXFLAGS) \\$$\$$< -o \$$(patsubst %.d,%.o, \$$@)\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \" > \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/makefile: makefile$${NEW_LINE}\ - mkdir -p \$$(dir \$$@)$${NEW_LINE}\ - cp makefile \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/: FORCE | %/makefile$${NEW_LINE}\ - @accesstime=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - \$$(MAKE) -C \$$@ SRCDIR=\$$(SRCDIR)\$$(notdir \$$(patsubst %/, %, \$$@))/ OBJECTS_BASE_DIR=\$$(OBJECTS_BASE_DIR) SOURCES_BASE_DIR=\$$(SOURCES_BASE_DIR) CXX_OTHER_FLAGS=\"\$$(CXX_OTHER_FLAGS)\" && \\$${NEW_LINE}\ - accesstime2=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - if [ "\$$\$$accesstime" -ne "\$$\$$accesstime2" ]; then \\$${NEW_LINE}\ - touch .; \\$${NEW_LINE}\ - fi$${NEW_LINE}\ - $${NEW_LINE}\ - FORCE:$${NEW_LINE}\ - $${NEW_LINE}\ - -include \$$(DEPENDENCIES)" > $@ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# final lib/bin construction - -lib-debug/$(FULL_LIBRARY): $(OBJECTS_DEBUG) obj-debug/ - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG) - -lib-release/$(FULL_LIBRARY): $(OBJECTS_RELEASE) obj-release/ - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE) - -test-bin-debug/$(TESTBIN): $(TEST_OBJECTS_DEBUG) test-obj-debug/ - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(TEST_OBJECTS_DEBUG) -o $@ $(TEST_LDFLAGS_DEBUG) - -test-bin-release/$(TESTBIN): $(TEST_OBJECTS_RELEASE) test-obj-release/ - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(TEST_OBJECTS_RELEASE) -o $@ $(TEST_LDFLAGS_RELEASE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# subdir make calls - -obj-debug/: FORCE obj-debug/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-debug) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-g -Og -DDEBUG" - -obj-release/: FORCE obj-release/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-release) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-O3 -DNDEBUG -DRELEASE $(LTO_PARAM)" - -test-obj-debug/: FORCE test-obj-debug/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath test-obj-debug) SOURCES_BASE_DIR=$(realpath test-src) CXX_OTHER_FLAGS="-g -Og -DDEBUG" - -test-obj-release/: FORCE test-obj-release/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath test-obj-release) SOURCES_BASE_DIR=$(realpath test-src) CXX_OTHER_FLAGS="-O3 -DNDEBUG -DRELEASE $(LTO_PARAM)" - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# objects dependencies - -$(OBJECTS_DEBUG): obj-debug/ - -$(OBJECTS_RELEASE): obj-release/ - -$(TEST_OBJECTS_DEBUG): test-obj-debug/ - -$(TEST_OBJECTS_RELEASE): test-obj-release/ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# standalone main targets - -test-unit-debug: - LD_LIBRARY_PATH="$(subst $(space),,$(addsuffix lib-debug:,$(LINK_PATHS)))lib-debug" test-bin-debug/$(TESTBIN) - -test-unit-release: - LD_LIBRARY_PATH="$(subst $(space),,$(addsuffix lib-release:,$(LINK_PATHS)))lib-release" test-bin-release/$(TESTBIN) - -build-test-debug: test-bin-debug/$(TESTBIN) - -build-test-release: test-bin-release/$(TESTBIN) - -build-code-debug: lib-debug/$(FULL_LIBRARY) - -build-code-release: lib-release/$(FULL_LIBRARY) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# do all main targets - -debug: - $(MAKE) build-code-debug - $(MAKE) build-test-debug - $(MAKE) test-unit-debug - -release: - $(MAKE) build-code-release - $(MAKE) build-test-release - $(MAKE) test-unit-release - -clean: clean-debug clean-release - $(RM) -r doc - -clean-debug: - if [ -L obj-debug ]; then\ - $(RM) -r `readlink obj-debug`;\ - fi - if [ -L lib-debug ]; then\ - $(RM) -r `readlink lib-debug`;\ - fi - if [ -L test-obj-debug ]; then\ - $(RM) -r `readlink test-obj-debug`;\ - fi - if [ -L test-bin-debug ]; then\ - $(RM) -r `readlink test-bin-debug`;\ - fi - $(RM) -r *.o *.d lib-debug obj-debug test-bin-debug test-obj-debug CppUnitTestResults.xml - -clean-release: - if [ -L obj-release ]; then\ - $(RM) -r `readlink obj-release`;\ - fi - if [ -L lib-release ]; then\ - $(RM) -r `readlink lib-release`;\ - fi - if [ -L test-obj-release ]; then\ - $(RM) -r `readlink test-obj-release`;\ - fi - if [ -L test-bin-release ]; then\ - $(RM) -r `readlink test-bin-release`;\ - fi - $(RM) -r *.o *.d lib-release obj-release test-bin-release test-obj-release CppUnitTestResults.xml - -doc: - doxygen +-include ../build.conf +-include ../makefile-library diff --git a/alib2std/makefile b/alib2std/makefile index c11946de9e..0b88694038 100644 --- a/alib2std/makefile +++ b/alib2std/makefile @@ -1,239 +1,3 @@ -SHELL:=/bin/bash - --include ../build.conf -include makefile.conf - -LTO_PARAM:= -ifeq ($(USE_LTO),1) -LTO_PARAM:= -flto -endif - -FULL_LIBRARY:=lib$(LIBRARY).so -define NEW_LINE - - -endef - -export NEW_LINE - -CXX_FLAGS := -Wall -pedantic -Wextra -Werror -Wshadow -Wpointer-arith -Wcast-qual -Wdelete-non-virtual-dtor -Wredundant-decls - -space := $(eval) $(eval) - -LDFLAGS_DEBUG:=-rdynamic -shared -TEST_LDFLAGS_DEBUG:=-Wl,--no-as-needed -Llib-debug $(addprefix -L, $(addsuffix lib-debug, $(LINK_PATHS))) -rdynamic -l$(LIBRARY) $(addprefix -l, $(LINK_LIBRARIES)) -lcppunit -Wl,-rpath,. - -LDFLAGS_RELEASE:=-rdynamic -shared $(LTO_PARAM) -TEST_LDFLAGS_RELEASE:=-Wl,--no-as-needed -Llib-release $(addprefix -L, $(addsuffix lib-release, $(LINK_PATHS))) -rdynamic -l$(LIBRARY) $(addprefix -l, $(LINK_LIBRARIES)) -lcppunit $(LTO_PARAM) -Wl,-rpath,. - -OBJECTS_DEBUG:=$(patsubst src/%.cpp,obj-debug/%.o, $(shell find src/ -name *cpp)) -TEST_OBJECTS_DEBUG:=$(patsubst test-src/%.cpp,test-obj-debug/%.o, $(shell find test-src/ -name *cpp)) - -OBJECTS_RELEASE:=$(patsubst src/%.cpp,obj-release/%.o, $(filter-out $(wildcard src/debug/*), $(shell find src/ -name *cpp))) -TEST_OBJECTS_RELEASE:=$(patsubst test-src/%.cpp,test-obj-release/%.o, $(shell find test-src/ -name *cpp)) - -.PHONY: all debug release clean build-debug build-release clean-debug clean-release doc - -all: - @echo "What to do master?" - -FORCE: - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# make subdir makefile - -%/makefile: makefile makefile.conf - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - echo "\ - SHELL:=/bin/bash$${NEW_LINE}\ - SRCDIR:=$${NEW_LINE}\ - $${NEW_LINE}\ - define NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - $${NEW_LINE}\ - endef$${NEW_LINE}\ - $${NEW_LINE}\ - export NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - CXXFLAGS:= -pipe -std=c++11 \$$(CXX_OTHER_FLAGS) -c $(CXX_FLAGS) -fPIC \$$(addprefix -I, \$$(realpath $(INCLUDE_PATHS))) -I\$$(realpath \$$(SOURCES_BASE_DIR)/../src/)$${NEW_LINE}\ - $${NEW_LINE}\ - SOURCES:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -type f -name \"*.cpp\")$${NEW_LINE}\ - DEPENDENCIES:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d, \$$(SOURCES))$${NEW_LINE}\ - OBJECTS:= \$$(patsubst %.d, %.o, \$$(DEPENDENCIES))$${NEW_LINE}\ - SOURCES_DIRS:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -mindepth 1 -type d)$${NEW_LINE}\ - OBJECTS_DIRS:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%, %/, \$$(SOURCES_DIRS))$${NEW_LINE}\ - OBJECTS_DIRS_MAKEFILES:= \$$(patsubst %, %makefile, \$$(OBJECTS_DIRS))$${NEW_LINE}\ - $${NEW_LINE}\ - .PHONY: all$${NEW_LINE}\ - .PRECIOUS: \$$(DEPENDECIES) \$$(OBJECTS_DIRS_MAKEFILES)$${NEW_LINE}\ - $${NEW_LINE}\ - all: \$$(OBJECTS_DIRS) \$$(OBJECTS)$${NEW_LINE}\ - $${NEW_LINE}\ - %.d: makefile$${NEW_LINE}\ - @echo \"\\$${NEW_LINE}\ - \$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\") = \\$$\$$(shell (\\$$\$$(CXX) -M \\$$\$$(CXXFLAGS) \$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) 2>/dev/null || echo \\\"\$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) FORCE\\\") | sed \\\"s/.*://g;s/\\\\\\\\\\\\\\\\//g\\\")\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \$$(patsubst %.d,%.o, \$$@): \\$$\$$(\$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\")) makefile\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \\$$\$$(CXX) \\$$\$$(CXXFLAGS) \\$$\$$< -o \$$(patsubst %.d,%.o, \$$@)\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \" > \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/makefile: makefile$${NEW_LINE}\ - mkdir -p \$$(dir \$$@)$${NEW_LINE}\ - cp makefile \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/: FORCE | %/makefile$${NEW_LINE}\ - @accesstime=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - \$$(MAKE) -C \$$@ SRCDIR=\$$(SRCDIR)\$$(notdir \$$(patsubst %/, %, \$$@))/ OBJECTS_BASE_DIR=\$$(OBJECTS_BASE_DIR) SOURCES_BASE_DIR=\$$(SOURCES_BASE_DIR) CXX_OTHER_FLAGS=\"\$$(CXX_OTHER_FLAGS)\" && \\$${NEW_LINE}\ - accesstime2=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - if [ "\$$\$$accesstime" -ne "\$$\$$accesstime2" ]; then \\$${NEW_LINE}\ - touch .; \\$${NEW_LINE}\ - fi$${NEW_LINE}\ - $${NEW_LINE}\ - FORCE:$${NEW_LINE}\ - $${NEW_LINE}\ - -include \$$(DEPENDENCIES)" > $@ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# final lib/bin construction - -lib-debug/$(FULL_LIBRARY): $(OBJECTS_DEBUG) obj-debug/ - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG) - -lib-release/$(FULL_LIBRARY): $(OBJECTS_RELEASE) obj-release/ - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE) - -test-bin-debug/$(TESTBIN): $(TEST_OBJECTS_DEBUG) test-obj-debug/ - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(TEST_OBJECTS_DEBUG) -o $@ $(TEST_LDFLAGS_DEBUG) - -test-bin-release/$(TESTBIN): $(TEST_OBJECTS_RELEASE) test-obj-release/ - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(TEST_OBJECTS_RELEASE) -o $@ $(TEST_LDFLAGS_RELEASE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# subdir make calls - -obj-debug/: FORCE obj-debug/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-debug) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-g -Og -DDEBUG" - -obj-release/: FORCE obj-release/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-release) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-O3 -DNDEBUG -DRELEASE $(LTO_PARAM)" - -test-obj-debug/: FORCE test-obj-debug/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath test-obj-debug) SOURCES_BASE_DIR=$(realpath test-src) CXX_OTHER_FLAGS="-g -Og -DDEBUG" - -test-obj-release/: FORCE test-obj-release/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath test-obj-release) SOURCES_BASE_DIR=$(realpath test-src) CXX_OTHER_FLAGS="-O3 -DNDEBUG -DRELEASE $(LTO_PARAM)" - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# objects dependencies - -$(OBJECTS_DEBUG): obj-debug/ - -$(OBJECTS_RELEASE): obj-release/ - -$(TEST_OBJECTS_DEBUG): test-obj-debug/ - -$(TEST_OBJECTS_RELEASE): test-obj-release/ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# standalone main targets - -test-unit-debug: - LD_LIBRARY_PATH="$(subst $(space),,$(addsuffix lib-debug:,$(LINK_PATHS)))lib-debug" test-bin-debug/$(TESTBIN) - -test-unit-release: - LD_LIBRARY_PATH="$(subst $(space),,$(addsuffix lib-release:,$(LINK_PATHS)))lib-release" test-bin-release/$(TESTBIN) - -build-test-debug: test-bin-debug/$(TESTBIN) - -build-test-release: test-bin-release/$(TESTBIN) - -build-code-debug: lib-debug/$(FULL_LIBRARY) - -build-code-release: lib-release/$(FULL_LIBRARY) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# do all main targets - -debug: - $(MAKE) build-code-debug - $(MAKE) build-test-debug - $(MAKE) test-unit-debug - -release: - $(MAKE) build-code-release - $(MAKE) build-test-release - $(MAKE) test-unit-release - -clean: clean-debug clean-release - $(RM) -r doc - -clean-debug: - if [ -L obj-debug ]; then\ - $(RM) -r `readlink obj-debug`;\ - fi - if [ -L lib-debug ]; then\ - $(RM) -r `readlink lib-debug`;\ - fi - if [ -L test-obj-debug ]; then\ - $(RM) -r `readlink test-obj-debug`;\ - fi - if [ -L test-bin-debug ]; then\ - $(RM) -r `readlink test-bin-debug`;\ - fi - $(RM) -r *.o *.d lib-debug obj-debug test-bin-debug test-obj-debug CppUnitTestResults.xml - -clean-release: - if [ -L obj-release ]; then\ - $(RM) -r `readlink obj-release`;\ - fi - if [ -L lib-release ]; then\ - $(RM) -r `readlink lib-release`;\ - fi - if [ -L test-obj-release ]; then\ - $(RM) -r `readlink test-obj-release`;\ - fi - if [ -L test-bin-release ]; then\ - $(RM) -r `readlink test-bin-release`;\ - fi - $(RM) -r *.o *.d lib-release obj-release test-bin-release test-obj-release CppUnitTestResults.xml - -doc: - doxygen +-include ../build.conf +-include ../makefile-library diff --git a/alib2str/makefile b/alib2str/makefile index c11946de9e..0b88694038 100644 --- a/alib2str/makefile +++ b/alib2str/makefile @@ -1,239 +1,3 @@ -SHELL:=/bin/bash - --include ../build.conf -include makefile.conf - -LTO_PARAM:= -ifeq ($(USE_LTO),1) -LTO_PARAM:= -flto -endif - -FULL_LIBRARY:=lib$(LIBRARY).so -define NEW_LINE - - -endef - -export NEW_LINE - -CXX_FLAGS := -Wall -pedantic -Wextra -Werror -Wshadow -Wpointer-arith -Wcast-qual -Wdelete-non-virtual-dtor -Wredundant-decls - -space := $(eval) $(eval) - -LDFLAGS_DEBUG:=-rdynamic -shared -TEST_LDFLAGS_DEBUG:=-Wl,--no-as-needed -Llib-debug $(addprefix -L, $(addsuffix lib-debug, $(LINK_PATHS))) -rdynamic -l$(LIBRARY) $(addprefix -l, $(LINK_LIBRARIES)) -lcppunit -Wl,-rpath,. - -LDFLAGS_RELEASE:=-rdynamic -shared $(LTO_PARAM) -TEST_LDFLAGS_RELEASE:=-Wl,--no-as-needed -Llib-release $(addprefix -L, $(addsuffix lib-release, $(LINK_PATHS))) -rdynamic -l$(LIBRARY) $(addprefix -l, $(LINK_LIBRARIES)) -lcppunit $(LTO_PARAM) -Wl,-rpath,. - -OBJECTS_DEBUG:=$(patsubst src/%.cpp,obj-debug/%.o, $(shell find src/ -name *cpp)) -TEST_OBJECTS_DEBUG:=$(patsubst test-src/%.cpp,test-obj-debug/%.o, $(shell find test-src/ -name *cpp)) - -OBJECTS_RELEASE:=$(patsubst src/%.cpp,obj-release/%.o, $(filter-out $(wildcard src/debug/*), $(shell find src/ -name *cpp))) -TEST_OBJECTS_RELEASE:=$(patsubst test-src/%.cpp,test-obj-release/%.o, $(shell find test-src/ -name *cpp)) - -.PHONY: all debug release clean build-debug build-release clean-debug clean-release doc - -all: - @echo "What to do master?" - -FORCE: - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# make subdir makefile - -%/makefile: makefile makefile.conf - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - echo "\ - SHELL:=/bin/bash$${NEW_LINE}\ - SRCDIR:=$${NEW_LINE}\ - $${NEW_LINE}\ - define NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - $${NEW_LINE}\ - endef$${NEW_LINE}\ - $${NEW_LINE}\ - export NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - CXXFLAGS:= -pipe -std=c++11 \$$(CXX_OTHER_FLAGS) -c $(CXX_FLAGS) -fPIC \$$(addprefix -I, \$$(realpath $(INCLUDE_PATHS))) -I\$$(realpath \$$(SOURCES_BASE_DIR)/../src/)$${NEW_LINE}\ - $${NEW_LINE}\ - SOURCES:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -type f -name \"*.cpp\")$${NEW_LINE}\ - DEPENDENCIES:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d, \$$(SOURCES))$${NEW_LINE}\ - OBJECTS:= \$$(patsubst %.d, %.o, \$$(DEPENDENCIES))$${NEW_LINE}\ - SOURCES_DIRS:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -mindepth 1 -type d)$${NEW_LINE}\ - OBJECTS_DIRS:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%, %/, \$$(SOURCES_DIRS))$${NEW_LINE}\ - OBJECTS_DIRS_MAKEFILES:= \$$(patsubst %, %makefile, \$$(OBJECTS_DIRS))$${NEW_LINE}\ - $${NEW_LINE}\ - .PHONY: all$${NEW_LINE}\ - .PRECIOUS: \$$(DEPENDECIES) \$$(OBJECTS_DIRS_MAKEFILES)$${NEW_LINE}\ - $${NEW_LINE}\ - all: \$$(OBJECTS_DIRS) \$$(OBJECTS)$${NEW_LINE}\ - $${NEW_LINE}\ - %.d: makefile$${NEW_LINE}\ - @echo \"\\$${NEW_LINE}\ - \$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\") = \\$$\$$(shell (\\$$\$$(CXX) -M \\$$\$$(CXXFLAGS) \$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) 2>/dev/null || echo \\\"\$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) FORCE\\\") | sed \\\"s/.*://g;s/\\\\\\\\\\\\\\\\//g\\\")\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \$$(patsubst %.d,%.o, \$$@): \\$$\$$(\$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\")) makefile\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \\$$\$$(CXX) \\$$\$$(CXXFLAGS) \\$$\$$< -o \$$(patsubst %.d,%.o, \$$@)\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \" > \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/makefile: makefile$${NEW_LINE}\ - mkdir -p \$$(dir \$$@)$${NEW_LINE}\ - cp makefile \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/: FORCE | %/makefile$${NEW_LINE}\ - @accesstime=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - \$$(MAKE) -C \$$@ SRCDIR=\$$(SRCDIR)\$$(notdir \$$(patsubst %/, %, \$$@))/ OBJECTS_BASE_DIR=\$$(OBJECTS_BASE_DIR) SOURCES_BASE_DIR=\$$(SOURCES_BASE_DIR) CXX_OTHER_FLAGS=\"\$$(CXX_OTHER_FLAGS)\" && \\$${NEW_LINE}\ - accesstime2=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - if [ "\$$\$$accesstime" -ne "\$$\$$accesstime2" ]; then \\$${NEW_LINE}\ - touch .; \\$${NEW_LINE}\ - fi$${NEW_LINE}\ - $${NEW_LINE}\ - FORCE:$${NEW_LINE}\ - $${NEW_LINE}\ - -include \$$(DEPENDENCIES)" > $@ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# final lib/bin construction - -lib-debug/$(FULL_LIBRARY): $(OBJECTS_DEBUG) obj-debug/ - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG) - -lib-release/$(FULL_LIBRARY): $(OBJECTS_RELEASE) obj-release/ - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE) - -test-bin-debug/$(TESTBIN): $(TEST_OBJECTS_DEBUG) test-obj-debug/ - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(TEST_OBJECTS_DEBUG) -o $@ $(TEST_LDFLAGS_DEBUG) - -test-bin-release/$(TESTBIN): $(TEST_OBJECTS_RELEASE) test-obj-release/ - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(TEST_OBJECTS_RELEASE) -o $@ $(TEST_LDFLAGS_RELEASE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# subdir make calls - -obj-debug/: FORCE obj-debug/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-debug) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-g -Og -DDEBUG" - -obj-release/: FORCE obj-release/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-release) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-O3 -DNDEBUG -DRELEASE $(LTO_PARAM)" - -test-obj-debug/: FORCE test-obj-debug/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath test-obj-debug) SOURCES_BASE_DIR=$(realpath test-src) CXX_OTHER_FLAGS="-g -Og -DDEBUG" - -test-obj-release/: FORCE test-obj-release/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath test-obj-release) SOURCES_BASE_DIR=$(realpath test-src) CXX_OTHER_FLAGS="-O3 -DNDEBUG -DRELEASE $(LTO_PARAM)" - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# objects dependencies - -$(OBJECTS_DEBUG): obj-debug/ - -$(OBJECTS_RELEASE): obj-release/ - -$(TEST_OBJECTS_DEBUG): test-obj-debug/ - -$(TEST_OBJECTS_RELEASE): test-obj-release/ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# standalone main targets - -test-unit-debug: - LD_LIBRARY_PATH="$(subst $(space),,$(addsuffix lib-debug:,$(LINK_PATHS)))lib-debug" test-bin-debug/$(TESTBIN) - -test-unit-release: - LD_LIBRARY_PATH="$(subst $(space),,$(addsuffix lib-release:,$(LINK_PATHS)))lib-release" test-bin-release/$(TESTBIN) - -build-test-debug: test-bin-debug/$(TESTBIN) - -build-test-release: test-bin-release/$(TESTBIN) - -build-code-debug: lib-debug/$(FULL_LIBRARY) - -build-code-release: lib-release/$(FULL_LIBRARY) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# do all main targets - -debug: - $(MAKE) build-code-debug - $(MAKE) build-test-debug - $(MAKE) test-unit-debug - -release: - $(MAKE) build-code-release - $(MAKE) build-test-release - $(MAKE) test-unit-release - -clean: clean-debug clean-release - $(RM) -r doc - -clean-debug: - if [ -L obj-debug ]; then\ - $(RM) -r `readlink obj-debug`;\ - fi - if [ -L lib-debug ]; then\ - $(RM) -r `readlink lib-debug`;\ - fi - if [ -L test-obj-debug ]; then\ - $(RM) -r `readlink test-obj-debug`;\ - fi - if [ -L test-bin-debug ]; then\ - $(RM) -r `readlink test-bin-debug`;\ - fi - $(RM) -r *.o *.d lib-debug obj-debug test-bin-debug test-obj-debug CppUnitTestResults.xml - -clean-release: - if [ -L obj-release ]; then\ - $(RM) -r `readlink obj-release`;\ - fi - if [ -L lib-release ]; then\ - $(RM) -r `readlink lib-release`;\ - fi - if [ -L test-obj-release ]; then\ - $(RM) -r `readlink test-obj-release`;\ - fi - if [ -L test-bin-release ]; then\ - $(RM) -r `readlink test-bin-release`;\ - fi - $(RM) -r *.o *.d lib-release obj-release test-bin-release test-obj-release CppUnitTestResults.xml - -doc: - doxygen +-include ../build.conf +-include ../makefile-library diff --git a/alib2str_experimental/makefile b/alib2str_experimental/makefile index c11946de9e..0b88694038 100644 --- a/alib2str_experimental/makefile +++ b/alib2str_experimental/makefile @@ -1,239 +1,3 @@ -SHELL:=/bin/bash - --include ../build.conf -include makefile.conf - -LTO_PARAM:= -ifeq ($(USE_LTO),1) -LTO_PARAM:= -flto -endif - -FULL_LIBRARY:=lib$(LIBRARY).so -define NEW_LINE - - -endef - -export NEW_LINE - -CXX_FLAGS := -Wall -pedantic -Wextra -Werror -Wshadow -Wpointer-arith -Wcast-qual -Wdelete-non-virtual-dtor -Wredundant-decls - -space := $(eval) $(eval) - -LDFLAGS_DEBUG:=-rdynamic -shared -TEST_LDFLAGS_DEBUG:=-Wl,--no-as-needed -Llib-debug $(addprefix -L, $(addsuffix lib-debug, $(LINK_PATHS))) -rdynamic -l$(LIBRARY) $(addprefix -l, $(LINK_LIBRARIES)) -lcppunit -Wl,-rpath,. - -LDFLAGS_RELEASE:=-rdynamic -shared $(LTO_PARAM) -TEST_LDFLAGS_RELEASE:=-Wl,--no-as-needed -Llib-release $(addprefix -L, $(addsuffix lib-release, $(LINK_PATHS))) -rdynamic -l$(LIBRARY) $(addprefix -l, $(LINK_LIBRARIES)) -lcppunit $(LTO_PARAM) -Wl,-rpath,. - -OBJECTS_DEBUG:=$(patsubst src/%.cpp,obj-debug/%.o, $(shell find src/ -name *cpp)) -TEST_OBJECTS_DEBUG:=$(patsubst test-src/%.cpp,test-obj-debug/%.o, $(shell find test-src/ -name *cpp)) - -OBJECTS_RELEASE:=$(patsubst src/%.cpp,obj-release/%.o, $(filter-out $(wildcard src/debug/*), $(shell find src/ -name *cpp))) -TEST_OBJECTS_RELEASE:=$(patsubst test-src/%.cpp,test-obj-release/%.o, $(shell find test-src/ -name *cpp)) - -.PHONY: all debug release clean build-debug build-release clean-debug clean-release doc - -all: - @echo "What to do master?" - -FORCE: - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# make subdir makefile - -%/makefile: makefile makefile.conf - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - echo "\ - SHELL:=/bin/bash$${NEW_LINE}\ - SRCDIR:=$${NEW_LINE}\ - $${NEW_LINE}\ - define NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - $${NEW_LINE}\ - endef$${NEW_LINE}\ - $${NEW_LINE}\ - export NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - CXXFLAGS:= -pipe -std=c++11 \$$(CXX_OTHER_FLAGS) -c $(CXX_FLAGS) -fPIC \$$(addprefix -I, \$$(realpath $(INCLUDE_PATHS))) -I\$$(realpath \$$(SOURCES_BASE_DIR)/../src/)$${NEW_LINE}\ - $${NEW_LINE}\ - SOURCES:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -type f -name \"*.cpp\")$${NEW_LINE}\ - DEPENDENCIES:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d, \$$(SOURCES))$${NEW_LINE}\ - OBJECTS:= \$$(patsubst %.d, %.o, \$$(DEPENDENCIES))$${NEW_LINE}\ - SOURCES_DIRS:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -mindepth 1 -type d)$${NEW_LINE}\ - OBJECTS_DIRS:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%, %/, \$$(SOURCES_DIRS))$${NEW_LINE}\ - OBJECTS_DIRS_MAKEFILES:= \$$(patsubst %, %makefile, \$$(OBJECTS_DIRS))$${NEW_LINE}\ - $${NEW_LINE}\ - .PHONY: all$${NEW_LINE}\ - .PRECIOUS: \$$(DEPENDECIES) \$$(OBJECTS_DIRS_MAKEFILES)$${NEW_LINE}\ - $${NEW_LINE}\ - all: \$$(OBJECTS_DIRS) \$$(OBJECTS)$${NEW_LINE}\ - $${NEW_LINE}\ - %.d: makefile$${NEW_LINE}\ - @echo \"\\$${NEW_LINE}\ - \$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\") = \\$$\$$(shell (\\$$\$$(CXX) -M \\$$\$$(CXXFLAGS) \$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) 2>/dev/null || echo \\\"\$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) FORCE\\\") | sed \\\"s/.*://g;s/\\\\\\\\\\\\\\\\//g\\\")\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \$$(patsubst %.d,%.o, \$$@): \\$$\$$(\$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\")) makefile\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \\$$\$$(CXX) \\$$\$$(CXXFLAGS) \\$$\$$< -o \$$(patsubst %.d,%.o, \$$@)\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \" > \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/makefile: makefile$${NEW_LINE}\ - mkdir -p \$$(dir \$$@)$${NEW_LINE}\ - cp makefile \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/: FORCE | %/makefile$${NEW_LINE}\ - @accesstime=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - \$$(MAKE) -C \$$@ SRCDIR=\$$(SRCDIR)\$$(notdir \$$(patsubst %/, %, \$$@))/ OBJECTS_BASE_DIR=\$$(OBJECTS_BASE_DIR) SOURCES_BASE_DIR=\$$(SOURCES_BASE_DIR) CXX_OTHER_FLAGS=\"\$$(CXX_OTHER_FLAGS)\" && \\$${NEW_LINE}\ - accesstime2=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - if [ "\$$\$$accesstime" -ne "\$$\$$accesstime2" ]; then \\$${NEW_LINE}\ - touch .; \\$${NEW_LINE}\ - fi$${NEW_LINE}\ - $${NEW_LINE}\ - FORCE:$${NEW_LINE}\ - $${NEW_LINE}\ - -include \$$(DEPENDENCIES)" > $@ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# final lib/bin construction - -lib-debug/$(FULL_LIBRARY): $(OBJECTS_DEBUG) obj-debug/ - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG) - -lib-release/$(FULL_LIBRARY): $(OBJECTS_RELEASE) obj-release/ - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE) - -test-bin-debug/$(TESTBIN): $(TEST_OBJECTS_DEBUG) test-obj-debug/ - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(TEST_OBJECTS_DEBUG) -o $@ $(TEST_LDFLAGS_DEBUG) - -test-bin-release/$(TESTBIN): $(TEST_OBJECTS_RELEASE) test-obj-release/ - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(TEST_OBJECTS_RELEASE) -o $@ $(TEST_LDFLAGS_RELEASE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# subdir make calls - -obj-debug/: FORCE obj-debug/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-debug) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-g -Og -DDEBUG" - -obj-release/: FORCE obj-release/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-release) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-O3 -DNDEBUG -DRELEASE $(LTO_PARAM)" - -test-obj-debug/: FORCE test-obj-debug/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath test-obj-debug) SOURCES_BASE_DIR=$(realpath test-src) CXX_OTHER_FLAGS="-g -Og -DDEBUG" - -test-obj-release/: FORCE test-obj-release/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath test-obj-release) SOURCES_BASE_DIR=$(realpath test-src) CXX_OTHER_FLAGS="-O3 -DNDEBUG -DRELEASE $(LTO_PARAM)" - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# objects dependencies - -$(OBJECTS_DEBUG): obj-debug/ - -$(OBJECTS_RELEASE): obj-release/ - -$(TEST_OBJECTS_DEBUG): test-obj-debug/ - -$(TEST_OBJECTS_RELEASE): test-obj-release/ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# standalone main targets - -test-unit-debug: - LD_LIBRARY_PATH="$(subst $(space),,$(addsuffix lib-debug:,$(LINK_PATHS)))lib-debug" test-bin-debug/$(TESTBIN) - -test-unit-release: - LD_LIBRARY_PATH="$(subst $(space),,$(addsuffix lib-release:,$(LINK_PATHS)))lib-release" test-bin-release/$(TESTBIN) - -build-test-debug: test-bin-debug/$(TESTBIN) - -build-test-release: test-bin-release/$(TESTBIN) - -build-code-debug: lib-debug/$(FULL_LIBRARY) - -build-code-release: lib-release/$(FULL_LIBRARY) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# do all main targets - -debug: - $(MAKE) build-code-debug - $(MAKE) build-test-debug - $(MAKE) test-unit-debug - -release: - $(MAKE) build-code-release - $(MAKE) build-test-release - $(MAKE) test-unit-release - -clean: clean-debug clean-release - $(RM) -r doc - -clean-debug: - if [ -L obj-debug ]; then\ - $(RM) -r `readlink obj-debug`;\ - fi - if [ -L lib-debug ]; then\ - $(RM) -r `readlink lib-debug`;\ - fi - if [ -L test-obj-debug ]; then\ - $(RM) -r `readlink test-obj-debug`;\ - fi - if [ -L test-bin-debug ]; then\ - $(RM) -r `readlink test-bin-debug`;\ - fi - $(RM) -r *.o *.d lib-debug obj-debug test-bin-debug test-obj-debug CppUnitTestResults.xml - -clean-release: - if [ -L obj-release ]; then\ - $(RM) -r `readlink obj-release`;\ - fi - if [ -L lib-release ]; then\ - $(RM) -r `readlink lib-release`;\ - fi - if [ -L test-obj-release ]; then\ - $(RM) -r `readlink test-obj-release`;\ - fi - if [ -L test-bin-release ]; then\ - $(RM) -r `readlink test-bin-release`;\ - fi - $(RM) -r *.o *.d lib-release obj-release test-bin-release test-obj-release CppUnitTestResults.xml - -doc: - doxygen +-include ../build.conf +-include ../makefile-library diff --git a/ameasure2/makefile b/ameasure2/makefile index 4064fd0131..bd9fb6f7bc 100644 --- a/ameasure2/makefile +++ b/ameasure2/makefile @@ -1,174 +1,3 @@ -SHELL:=/bin/bash - --include ../build.conf -include makefile.conf - -LTO_PARAM:= -ifeq ($(USE_LTO),1) -LTO_PARAM:= -flto -endif - -define NEW_LINE - - -endef - -export NEW_LINE - -CXX_FLAGS := -Wall -pedantic -Wextra -Werror -Wshadow -Wpointer-arith -Wcast-qual -Wdelete-non-virtual-dtor -Wredundant-decls - -LDFLAGS_DEBUG:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-debug, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) -Wl,-rpath,. - -LDFLAGS_RELEASE:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-release, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) $(LTO_PARAM) -Wl,-rpath,. - -OBJECTS_DEBUG:=$(patsubst src/%.cpp,obj-debug/%.o, $(shell find src/ -name *cpp)) - -OBJECTS_RELEASE:=$(patsubst src/%.cpp,obj-release/%.o, $(shell find src/ -name *cpp)) - -.PHONY: all build-debug clean-debug doc - -all: - @echo "What to do master?" - -FORCE: - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# make subdir makefile - -%/makefile: makefile makefile.conf - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - echo "\ - SHELL:=/bin/bash$${NEW_LINE}\ - SRCDIR:=$${NEW_LINE}\ - $${NEW_LINE}\ - define NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - $${NEW_LINE}\ - endef$${NEW_LINE}\ - $${NEW_LINE}\ - export NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - CXXFLAGS:= -pipe -std=c++11 \$$(CXX_OTHER_FLAGS) -c $(CXX_FLAGS) -fPIC \$$(addprefix -I, \$$(realpath $(INCLUDE_PATHS)))$${NEW_LINE}\ - $${NEW_LINE}\ - SOURCES:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -type f -name \"*.cpp\")$${NEW_LINE}\ - DEPENDENCIES:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d, \$$(SOURCES))$${NEW_LINE}\ - OBJECTS:= \$$(patsubst %.d, %.o, \$$(DEPENDENCIES))$${NEW_LINE}\ - SOURCES_DIRS:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -mindepth 1 -type d)$${NEW_LINE}\ - OBJECTS_DIRS:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%, %/, \$$(SOURCES_DIRS))$${NEW_LINE}\ - OBJECTS_DIRS_MAKEFILES:= \$$(patsubst %, %makefile, \$$(OBJECTS_DIRS))$${NEW_LINE}\ - $${NEW_LINE}\ - .PHONY: all$${NEW_LINE}\ - .PRECIOUS: \$$(DEPENDECIES) \$$(OBJECTS_DIRS_MAKEFILES)$${NEW_LINE}\ - $${NEW_LINE}\ - all: \$$(OBJECTS_DIRS) \$$(OBJECTS)$${NEW_LINE}\ - $${NEW_LINE}\ - %.d: makefile$${NEW_LINE}\ - @echo \"\\$${NEW_LINE}\ - \$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\") = \\$$\$$(shell (\\$$\$$(CXX) -M \\$$\$$(CXXFLAGS) \$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) 2>/dev/null || echo \\\"\$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) FORCE\\\") | sed \\\"s/.*://g;s/\\\\\\\\\\\\\\\\//g\\\")\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \$$(patsubst %.d,%.o, \$$@): \\$$\$$(\$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\")) makefile\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \\$$\$$(CXX) \\$$\$$(CXXFLAGS) \\$$\$$< -o \$$(patsubst %.d,%.o, \$$@)\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \" > \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/makefile: makefile$${NEW_LINE}\ - mkdir -p \$$(dir \$$@)$${NEW_LINE}\ - cp makefile \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/: FORCE | %/makefile$${NEW_LINE}\ - @accesstime=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - \$$(MAKE) -C \$$@ SRCDIR=\$$(SRCDIR)\$$(notdir \$$(patsubst %/, %, \$$@))/ OBJECTS_BASE_DIR=\$$(OBJECTS_BASE_DIR) SOURCES_BASE_DIR=\$$(SOURCES_BASE_DIR) CXX_OTHER_FLAGS=\"\$$(CXX_OTHER_FLAGS)\" && \\$${NEW_LINE}\ - accesstime2=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - if [ "\$$\$$accesstime" -ne "\$$\$$accesstime2" ]; then \\$${NEW_LINE}\ - touch .; \\$${NEW_LINE}\ - fi$${NEW_LINE}\ - $${NEW_LINE}\ - FORCE:$${NEW_LINE}\ - $${NEW_LINE}\ - -include \$$(DEPENDENCIES)" > $@ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# final lib/bin construction - -bin-debug/$(EXECUTABLE): obj-debug/ $(OBJECTS_DEBUG) - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG) - -bin-release/$(EXECUTABLE): obj-release/ $(OBJECTS_RELEASE) - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# subdir make calls - -obj-debug/: FORCE | obj-debug/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-debug) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-g -Og -DDEBUG" - -obj-release/: FORCE | obj-release/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-release) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-O3 -DNDEBUG -DRELEASE $(LTO_PARAM)" - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# objects dependencies - -$(OBJECTS_DEBUG): obj-debug/ - -$(OBJECTS_RELEASE): obj-release/ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# standalone main targets - -build-code-debug: bin-debug/$(EXECUTABLE) - -build-code-release: bin-release/$(EXECUTABLE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# do all main targets - -debug: - $(MAKE) build-code-debug - -release: - $(MAKE) build-code-release - -clean: clean-debug clean-release - $(RM) -r doc - -clean-debug: - if [ -L obj-debug ]; then\ - $(RM) -r `readlink obj-debug`;\ - fi - if [ -L bin-debug ]; then\ - $(RM) -r `readlink bin-debug`;\ - fi - $(RM) -r *.o *.d bin-debug obj-debug - -clean-release: - if [ -L obj-release ]; then\ - $(RM) -r `readlink obj-release`;\ - fi - if [ -L lib-release ]; then\ - $(RM) -r `readlink lib-release`;\ - fi - $(RM) -r *.o *.d bin-release obj-release - -doc: - doxygen +-include ../build.conf +-include ../makefile-binary diff --git a/ameasurep2/makefile b/ameasurep2/makefile index 4064fd0131..bd9fb6f7bc 100644 --- a/ameasurep2/makefile +++ b/ameasurep2/makefile @@ -1,174 +1,3 @@ -SHELL:=/bin/bash - --include ../build.conf -include makefile.conf - -LTO_PARAM:= -ifeq ($(USE_LTO),1) -LTO_PARAM:= -flto -endif - -define NEW_LINE - - -endef - -export NEW_LINE - -CXX_FLAGS := -Wall -pedantic -Wextra -Werror -Wshadow -Wpointer-arith -Wcast-qual -Wdelete-non-virtual-dtor -Wredundant-decls - -LDFLAGS_DEBUG:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-debug, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) -Wl,-rpath,. - -LDFLAGS_RELEASE:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-release, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) $(LTO_PARAM) -Wl,-rpath,. - -OBJECTS_DEBUG:=$(patsubst src/%.cpp,obj-debug/%.o, $(shell find src/ -name *cpp)) - -OBJECTS_RELEASE:=$(patsubst src/%.cpp,obj-release/%.o, $(shell find src/ -name *cpp)) - -.PHONY: all build-debug clean-debug doc - -all: - @echo "What to do master?" - -FORCE: - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# make subdir makefile - -%/makefile: makefile makefile.conf - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - echo "\ - SHELL:=/bin/bash$${NEW_LINE}\ - SRCDIR:=$${NEW_LINE}\ - $${NEW_LINE}\ - define NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - $${NEW_LINE}\ - endef$${NEW_LINE}\ - $${NEW_LINE}\ - export NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - CXXFLAGS:= -pipe -std=c++11 \$$(CXX_OTHER_FLAGS) -c $(CXX_FLAGS) -fPIC \$$(addprefix -I, \$$(realpath $(INCLUDE_PATHS)))$${NEW_LINE}\ - $${NEW_LINE}\ - SOURCES:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -type f -name \"*.cpp\")$${NEW_LINE}\ - DEPENDENCIES:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d, \$$(SOURCES))$${NEW_LINE}\ - OBJECTS:= \$$(patsubst %.d, %.o, \$$(DEPENDENCIES))$${NEW_LINE}\ - SOURCES_DIRS:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -mindepth 1 -type d)$${NEW_LINE}\ - OBJECTS_DIRS:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%, %/, \$$(SOURCES_DIRS))$${NEW_LINE}\ - OBJECTS_DIRS_MAKEFILES:= \$$(patsubst %, %makefile, \$$(OBJECTS_DIRS))$${NEW_LINE}\ - $${NEW_LINE}\ - .PHONY: all$${NEW_LINE}\ - .PRECIOUS: \$$(DEPENDECIES) \$$(OBJECTS_DIRS_MAKEFILES)$${NEW_LINE}\ - $${NEW_LINE}\ - all: \$$(OBJECTS_DIRS) \$$(OBJECTS)$${NEW_LINE}\ - $${NEW_LINE}\ - %.d: makefile$${NEW_LINE}\ - @echo \"\\$${NEW_LINE}\ - \$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\") = \\$$\$$(shell (\\$$\$$(CXX) -M \\$$\$$(CXXFLAGS) \$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) 2>/dev/null || echo \\\"\$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) FORCE\\\") | sed \\\"s/.*://g;s/\\\\\\\\\\\\\\\\//g\\\")\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \$$(patsubst %.d,%.o, \$$@): \\$$\$$(\$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\")) makefile\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \\$$\$$(CXX) \\$$\$$(CXXFLAGS) \\$$\$$< -o \$$(patsubst %.d,%.o, \$$@)\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \" > \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/makefile: makefile$${NEW_LINE}\ - mkdir -p \$$(dir \$$@)$${NEW_LINE}\ - cp makefile \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/: FORCE | %/makefile$${NEW_LINE}\ - @accesstime=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - \$$(MAKE) -C \$$@ SRCDIR=\$$(SRCDIR)\$$(notdir \$$(patsubst %/, %, \$$@))/ OBJECTS_BASE_DIR=\$$(OBJECTS_BASE_DIR) SOURCES_BASE_DIR=\$$(SOURCES_BASE_DIR) CXX_OTHER_FLAGS=\"\$$(CXX_OTHER_FLAGS)\" && \\$${NEW_LINE}\ - accesstime2=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - if [ "\$$\$$accesstime" -ne "\$$\$$accesstime2" ]; then \\$${NEW_LINE}\ - touch .; \\$${NEW_LINE}\ - fi$${NEW_LINE}\ - $${NEW_LINE}\ - FORCE:$${NEW_LINE}\ - $${NEW_LINE}\ - -include \$$(DEPENDENCIES)" > $@ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# final lib/bin construction - -bin-debug/$(EXECUTABLE): obj-debug/ $(OBJECTS_DEBUG) - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG) - -bin-release/$(EXECUTABLE): obj-release/ $(OBJECTS_RELEASE) - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# subdir make calls - -obj-debug/: FORCE | obj-debug/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-debug) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-g -Og -DDEBUG" - -obj-release/: FORCE | obj-release/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-release) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-O3 -DNDEBUG -DRELEASE $(LTO_PARAM)" - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# objects dependencies - -$(OBJECTS_DEBUG): obj-debug/ - -$(OBJECTS_RELEASE): obj-release/ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# standalone main targets - -build-code-debug: bin-debug/$(EXECUTABLE) - -build-code-release: bin-release/$(EXECUTABLE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# do all main targets - -debug: - $(MAKE) build-code-debug - -release: - $(MAKE) build-code-release - -clean: clean-debug clean-release - $(RM) -r doc - -clean-debug: - if [ -L obj-debug ]; then\ - $(RM) -r `readlink obj-debug`;\ - fi - if [ -L bin-debug ]; then\ - $(RM) -r `readlink bin-debug`;\ - fi - $(RM) -r *.o *.d bin-debug obj-debug - -clean-release: - if [ -L obj-release ]; then\ - $(RM) -r `readlink obj-release`;\ - fi - if [ -L lib-release ]; then\ - $(RM) -r `readlink lib-release`;\ - fi - $(RM) -r *.o *.d bin-release obj-release - -doc: - doxygen +-include ../build.conf +-include ../makefile-binary diff --git a/aminimize2/makefile b/aminimize2/makefile index 4064fd0131..bd9fb6f7bc 100644 --- a/aminimize2/makefile +++ b/aminimize2/makefile @@ -1,174 +1,3 @@ -SHELL:=/bin/bash - --include ../build.conf -include makefile.conf - -LTO_PARAM:= -ifeq ($(USE_LTO),1) -LTO_PARAM:= -flto -endif - -define NEW_LINE - - -endef - -export NEW_LINE - -CXX_FLAGS := -Wall -pedantic -Wextra -Werror -Wshadow -Wpointer-arith -Wcast-qual -Wdelete-non-virtual-dtor -Wredundant-decls - -LDFLAGS_DEBUG:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-debug, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) -Wl,-rpath,. - -LDFLAGS_RELEASE:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-release, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) $(LTO_PARAM) -Wl,-rpath,. - -OBJECTS_DEBUG:=$(patsubst src/%.cpp,obj-debug/%.o, $(shell find src/ -name *cpp)) - -OBJECTS_RELEASE:=$(patsubst src/%.cpp,obj-release/%.o, $(shell find src/ -name *cpp)) - -.PHONY: all build-debug clean-debug doc - -all: - @echo "What to do master?" - -FORCE: - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# make subdir makefile - -%/makefile: makefile makefile.conf - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - echo "\ - SHELL:=/bin/bash$${NEW_LINE}\ - SRCDIR:=$${NEW_LINE}\ - $${NEW_LINE}\ - define NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - $${NEW_LINE}\ - endef$${NEW_LINE}\ - $${NEW_LINE}\ - export NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - CXXFLAGS:= -pipe -std=c++11 \$$(CXX_OTHER_FLAGS) -c $(CXX_FLAGS) -fPIC \$$(addprefix -I, \$$(realpath $(INCLUDE_PATHS)))$${NEW_LINE}\ - $${NEW_LINE}\ - SOURCES:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -type f -name \"*.cpp\")$${NEW_LINE}\ - DEPENDENCIES:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d, \$$(SOURCES))$${NEW_LINE}\ - OBJECTS:= \$$(patsubst %.d, %.o, \$$(DEPENDENCIES))$${NEW_LINE}\ - SOURCES_DIRS:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -mindepth 1 -type d)$${NEW_LINE}\ - OBJECTS_DIRS:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%, %/, \$$(SOURCES_DIRS))$${NEW_LINE}\ - OBJECTS_DIRS_MAKEFILES:= \$$(patsubst %, %makefile, \$$(OBJECTS_DIRS))$${NEW_LINE}\ - $${NEW_LINE}\ - .PHONY: all$${NEW_LINE}\ - .PRECIOUS: \$$(DEPENDECIES) \$$(OBJECTS_DIRS_MAKEFILES)$${NEW_LINE}\ - $${NEW_LINE}\ - all: \$$(OBJECTS_DIRS) \$$(OBJECTS)$${NEW_LINE}\ - $${NEW_LINE}\ - %.d: makefile$${NEW_LINE}\ - @echo \"\\$${NEW_LINE}\ - \$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\") = \\$$\$$(shell (\\$$\$$(CXX) -M \\$$\$$(CXXFLAGS) \$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) 2>/dev/null || echo \\\"\$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) FORCE\\\") | sed \\\"s/.*://g;s/\\\\\\\\\\\\\\\\//g\\\")\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \$$(patsubst %.d,%.o, \$$@): \\$$\$$(\$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\")) makefile\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \\$$\$$(CXX) \\$$\$$(CXXFLAGS) \\$$\$$< -o \$$(patsubst %.d,%.o, \$$@)\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \" > \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/makefile: makefile$${NEW_LINE}\ - mkdir -p \$$(dir \$$@)$${NEW_LINE}\ - cp makefile \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/: FORCE | %/makefile$${NEW_LINE}\ - @accesstime=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - \$$(MAKE) -C \$$@ SRCDIR=\$$(SRCDIR)\$$(notdir \$$(patsubst %/, %, \$$@))/ OBJECTS_BASE_DIR=\$$(OBJECTS_BASE_DIR) SOURCES_BASE_DIR=\$$(SOURCES_BASE_DIR) CXX_OTHER_FLAGS=\"\$$(CXX_OTHER_FLAGS)\" && \\$${NEW_LINE}\ - accesstime2=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - if [ "\$$\$$accesstime" -ne "\$$\$$accesstime2" ]; then \\$${NEW_LINE}\ - touch .; \\$${NEW_LINE}\ - fi$${NEW_LINE}\ - $${NEW_LINE}\ - FORCE:$${NEW_LINE}\ - $${NEW_LINE}\ - -include \$$(DEPENDENCIES)" > $@ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# final lib/bin construction - -bin-debug/$(EXECUTABLE): obj-debug/ $(OBJECTS_DEBUG) - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG) - -bin-release/$(EXECUTABLE): obj-release/ $(OBJECTS_RELEASE) - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# subdir make calls - -obj-debug/: FORCE | obj-debug/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-debug) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-g -Og -DDEBUG" - -obj-release/: FORCE | obj-release/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-release) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-O3 -DNDEBUG -DRELEASE $(LTO_PARAM)" - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# objects dependencies - -$(OBJECTS_DEBUG): obj-debug/ - -$(OBJECTS_RELEASE): obj-release/ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# standalone main targets - -build-code-debug: bin-debug/$(EXECUTABLE) - -build-code-release: bin-release/$(EXECUTABLE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# do all main targets - -debug: - $(MAKE) build-code-debug - -release: - $(MAKE) build-code-release - -clean: clean-debug clean-release - $(RM) -r doc - -clean-debug: - if [ -L obj-debug ]; then\ - $(RM) -r `readlink obj-debug`;\ - fi - if [ -L bin-debug ]; then\ - $(RM) -r `readlink bin-debug`;\ - fi - $(RM) -r *.o *.d bin-debug obj-debug - -clean-release: - if [ -L obj-release ]; then\ - $(RM) -r `readlink obj-release`;\ - fi - if [ -L lib-release ]; then\ - $(RM) -r `readlink lib-release`;\ - fi - $(RM) -r *.o *.d bin-release obj-release - -doc: - doxygen +-include ../build.conf +-include ../makefile-binary diff --git a/anormalize2/makefile b/anormalize2/makefile index 4064fd0131..bd9fb6f7bc 100644 --- a/anormalize2/makefile +++ b/anormalize2/makefile @@ -1,174 +1,3 @@ -SHELL:=/bin/bash - --include ../build.conf -include makefile.conf - -LTO_PARAM:= -ifeq ($(USE_LTO),1) -LTO_PARAM:= -flto -endif - -define NEW_LINE - - -endef - -export NEW_LINE - -CXX_FLAGS := -Wall -pedantic -Wextra -Werror -Wshadow -Wpointer-arith -Wcast-qual -Wdelete-non-virtual-dtor -Wredundant-decls - -LDFLAGS_DEBUG:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-debug, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) -Wl,-rpath,. - -LDFLAGS_RELEASE:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-release, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) $(LTO_PARAM) -Wl,-rpath,. - -OBJECTS_DEBUG:=$(patsubst src/%.cpp,obj-debug/%.o, $(shell find src/ -name *cpp)) - -OBJECTS_RELEASE:=$(patsubst src/%.cpp,obj-release/%.o, $(shell find src/ -name *cpp)) - -.PHONY: all build-debug clean-debug doc - -all: - @echo "What to do master?" - -FORCE: - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# make subdir makefile - -%/makefile: makefile makefile.conf - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - echo "\ - SHELL:=/bin/bash$${NEW_LINE}\ - SRCDIR:=$${NEW_LINE}\ - $${NEW_LINE}\ - define NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - $${NEW_LINE}\ - endef$${NEW_LINE}\ - $${NEW_LINE}\ - export NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - CXXFLAGS:= -pipe -std=c++11 \$$(CXX_OTHER_FLAGS) -c $(CXX_FLAGS) -fPIC \$$(addprefix -I, \$$(realpath $(INCLUDE_PATHS)))$${NEW_LINE}\ - $${NEW_LINE}\ - SOURCES:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -type f -name \"*.cpp\")$${NEW_LINE}\ - DEPENDENCIES:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d, \$$(SOURCES))$${NEW_LINE}\ - OBJECTS:= \$$(patsubst %.d, %.o, \$$(DEPENDENCIES))$${NEW_LINE}\ - SOURCES_DIRS:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -mindepth 1 -type d)$${NEW_LINE}\ - OBJECTS_DIRS:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%, %/, \$$(SOURCES_DIRS))$${NEW_LINE}\ - OBJECTS_DIRS_MAKEFILES:= \$$(patsubst %, %makefile, \$$(OBJECTS_DIRS))$${NEW_LINE}\ - $${NEW_LINE}\ - .PHONY: all$${NEW_LINE}\ - .PRECIOUS: \$$(DEPENDECIES) \$$(OBJECTS_DIRS_MAKEFILES)$${NEW_LINE}\ - $${NEW_LINE}\ - all: \$$(OBJECTS_DIRS) \$$(OBJECTS)$${NEW_LINE}\ - $${NEW_LINE}\ - %.d: makefile$${NEW_LINE}\ - @echo \"\\$${NEW_LINE}\ - \$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\") = \\$$\$$(shell (\\$$\$$(CXX) -M \\$$\$$(CXXFLAGS) \$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) 2>/dev/null || echo \\\"\$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) FORCE\\\") | sed \\\"s/.*://g;s/\\\\\\\\\\\\\\\\//g\\\")\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \$$(patsubst %.d,%.o, \$$@): \\$$\$$(\$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\")) makefile\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \\$$\$$(CXX) \\$$\$$(CXXFLAGS) \\$$\$$< -o \$$(patsubst %.d,%.o, \$$@)\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \" > \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/makefile: makefile$${NEW_LINE}\ - mkdir -p \$$(dir \$$@)$${NEW_LINE}\ - cp makefile \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/: FORCE | %/makefile$${NEW_LINE}\ - @accesstime=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - \$$(MAKE) -C \$$@ SRCDIR=\$$(SRCDIR)\$$(notdir \$$(patsubst %/, %, \$$@))/ OBJECTS_BASE_DIR=\$$(OBJECTS_BASE_DIR) SOURCES_BASE_DIR=\$$(SOURCES_BASE_DIR) CXX_OTHER_FLAGS=\"\$$(CXX_OTHER_FLAGS)\" && \\$${NEW_LINE}\ - accesstime2=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - if [ "\$$\$$accesstime" -ne "\$$\$$accesstime2" ]; then \\$${NEW_LINE}\ - touch .; \\$${NEW_LINE}\ - fi$${NEW_LINE}\ - $${NEW_LINE}\ - FORCE:$${NEW_LINE}\ - $${NEW_LINE}\ - -include \$$(DEPENDENCIES)" > $@ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# final lib/bin construction - -bin-debug/$(EXECUTABLE): obj-debug/ $(OBJECTS_DEBUG) - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG) - -bin-release/$(EXECUTABLE): obj-release/ $(OBJECTS_RELEASE) - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# subdir make calls - -obj-debug/: FORCE | obj-debug/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-debug) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-g -Og -DDEBUG" - -obj-release/: FORCE | obj-release/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-release) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-O3 -DNDEBUG -DRELEASE $(LTO_PARAM)" - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# objects dependencies - -$(OBJECTS_DEBUG): obj-debug/ - -$(OBJECTS_RELEASE): obj-release/ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# standalone main targets - -build-code-debug: bin-debug/$(EXECUTABLE) - -build-code-release: bin-release/$(EXECUTABLE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# do all main targets - -debug: - $(MAKE) build-code-debug - -release: - $(MAKE) build-code-release - -clean: clean-debug clean-release - $(RM) -r doc - -clean-debug: - if [ -L obj-debug ]; then\ - $(RM) -r `readlink obj-debug`;\ - fi - if [ -L bin-debug ]; then\ - $(RM) -r `readlink bin-debug`;\ - fi - $(RM) -r *.o *.d bin-debug obj-debug - -clean-release: - if [ -L obj-release ]; then\ - $(RM) -r `readlink obj-release`;\ - fi - if [ -L lib-release ]; then\ - $(RM) -r `readlink lib-release`;\ - fi - $(RM) -r *.o *.d bin-release obj-release - -doc: - doxygen +-include ../build.conf +-include ../makefile-binary diff --git a/aquery2/makefile b/aquery2/makefile index 4064fd0131..bd9fb6f7bc 100644 --- a/aquery2/makefile +++ b/aquery2/makefile @@ -1,174 +1,3 @@ -SHELL:=/bin/bash - --include ../build.conf -include makefile.conf - -LTO_PARAM:= -ifeq ($(USE_LTO),1) -LTO_PARAM:= -flto -endif - -define NEW_LINE - - -endef - -export NEW_LINE - -CXX_FLAGS := -Wall -pedantic -Wextra -Werror -Wshadow -Wpointer-arith -Wcast-qual -Wdelete-non-virtual-dtor -Wredundant-decls - -LDFLAGS_DEBUG:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-debug, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) -Wl,-rpath,. - -LDFLAGS_RELEASE:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-release, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) $(LTO_PARAM) -Wl,-rpath,. - -OBJECTS_DEBUG:=$(patsubst src/%.cpp,obj-debug/%.o, $(shell find src/ -name *cpp)) - -OBJECTS_RELEASE:=$(patsubst src/%.cpp,obj-release/%.o, $(shell find src/ -name *cpp)) - -.PHONY: all build-debug clean-debug doc - -all: - @echo "What to do master?" - -FORCE: - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# make subdir makefile - -%/makefile: makefile makefile.conf - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - echo "\ - SHELL:=/bin/bash$${NEW_LINE}\ - SRCDIR:=$${NEW_LINE}\ - $${NEW_LINE}\ - define NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - $${NEW_LINE}\ - endef$${NEW_LINE}\ - $${NEW_LINE}\ - export NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - CXXFLAGS:= -pipe -std=c++11 \$$(CXX_OTHER_FLAGS) -c $(CXX_FLAGS) -fPIC \$$(addprefix -I, \$$(realpath $(INCLUDE_PATHS)))$${NEW_LINE}\ - $${NEW_LINE}\ - SOURCES:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -type f -name \"*.cpp\")$${NEW_LINE}\ - DEPENDENCIES:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d, \$$(SOURCES))$${NEW_LINE}\ - OBJECTS:= \$$(patsubst %.d, %.o, \$$(DEPENDENCIES))$${NEW_LINE}\ - SOURCES_DIRS:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -mindepth 1 -type d)$${NEW_LINE}\ - OBJECTS_DIRS:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%, %/, \$$(SOURCES_DIRS))$${NEW_LINE}\ - OBJECTS_DIRS_MAKEFILES:= \$$(patsubst %, %makefile, \$$(OBJECTS_DIRS))$${NEW_LINE}\ - $${NEW_LINE}\ - .PHONY: all$${NEW_LINE}\ - .PRECIOUS: \$$(DEPENDECIES) \$$(OBJECTS_DIRS_MAKEFILES)$${NEW_LINE}\ - $${NEW_LINE}\ - all: \$$(OBJECTS_DIRS) \$$(OBJECTS)$${NEW_LINE}\ - $${NEW_LINE}\ - %.d: makefile$${NEW_LINE}\ - @echo \"\\$${NEW_LINE}\ - \$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\") = \\$$\$$(shell (\\$$\$$(CXX) -M \\$$\$$(CXXFLAGS) \$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) 2>/dev/null || echo \\\"\$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) FORCE\\\") | sed \\\"s/.*://g;s/\\\\\\\\\\\\\\\\//g\\\")\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \$$(patsubst %.d,%.o, \$$@): \\$$\$$(\$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\")) makefile\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \\$$\$$(CXX) \\$$\$$(CXXFLAGS) \\$$\$$< -o \$$(patsubst %.d,%.o, \$$@)\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \" > \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/makefile: makefile$${NEW_LINE}\ - mkdir -p \$$(dir \$$@)$${NEW_LINE}\ - cp makefile \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/: FORCE | %/makefile$${NEW_LINE}\ - @accesstime=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - \$$(MAKE) -C \$$@ SRCDIR=\$$(SRCDIR)\$$(notdir \$$(patsubst %/, %, \$$@))/ OBJECTS_BASE_DIR=\$$(OBJECTS_BASE_DIR) SOURCES_BASE_DIR=\$$(SOURCES_BASE_DIR) CXX_OTHER_FLAGS=\"\$$(CXX_OTHER_FLAGS)\" && \\$${NEW_LINE}\ - accesstime2=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - if [ "\$$\$$accesstime" -ne "\$$\$$accesstime2" ]; then \\$${NEW_LINE}\ - touch .; \\$${NEW_LINE}\ - fi$${NEW_LINE}\ - $${NEW_LINE}\ - FORCE:$${NEW_LINE}\ - $${NEW_LINE}\ - -include \$$(DEPENDENCIES)" > $@ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# final lib/bin construction - -bin-debug/$(EXECUTABLE): obj-debug/ $(OBJECTS_DEBUG) - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG) - -bin-release/$(EXECUTABLE): obj-release/ $(OBJECTS_RELEASE) - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# subdir make calls - -obj-debug/: FORCE | obj-debug/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-debug) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-g -Og -DDEBUG" - -obj-release/: FORCE | obj-release/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-release) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-O3 -DNDEBUG -DRELEASE $(LTO_PARAM)" - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# objects dependencies - -$(OBJECTS_DEBUG): obj-debug/ - -$(OBJECTS_RELEASE): obj-release/ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# standalone main targets - -build-code-debug: bin-debug/$(EXECUTABLE) - -build-code-release: bin-release/$(EXECUTABLE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# do all main targets - -debug: - $(MAKE) build-code-debug - -release: - $(MAKE) build-code-release - -clean: clean-debug clean-release - $(RM) -r doc - -clean-debug: - if [ -L obj-debug ]; then\ - $(RM) -r `readlink obj-debug`;\ - fi - if [ -L bin-debug ]; then\ - $(RM) -r `readlink bin-debug`;\ - fi - $(RM) -r *.o *.d bin-debug obj-debug - -clean-release: - if [ -L obj-release ]; then\ - $(RM) -r `readlink obj-release`;\ - fi - if [ -L lib-release ]; then\ - $(RM) -r `readlink lib-release`;\ - fi - $(RM) -r *.o *.d bin-release obj-release - -doc: - doxygen +-include ../build.conf +-include ../makefile-binary diff --git a/arand2/makefile b/arand2/makefile index 4064fd0131..bd9fb6f7bc 100644 --- a/arand2/makefile +++ b/arand2/makefile @@ -1,174 +1,3 @@ -SHELL:=/bin/bash - --include ../build.conf -include makefile.conf - -LTO_PARAM:= -ifeq ($(USE_LTO),1) -LTO_PARAM:= -flto -endif - -define NEW_LINE - - -endef - -export NEW_LINE - -CXX_FLAGS := -Wall -pedantic -Wextra -Werror -Wshadow -Wpointer-arith -Wcast-qual -Wdelete-non-virtual-dtor -Wredundant-decls - -LDFLAGS_DEBUG:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-debug, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) -Wl,-rpath,. - -LDFLAGS_RELEASE:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-release, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) $(LTO_PARAM) -Wl,-rpath,. - -OBJECTS_DEBUG:=$(patsubst src/%.cpp,obj-debug/%.o, $(shell find src/ -name *cpp)) - -OBJECTS_RELEASE:=$(patsubst src/%.cpp,obj-release/%.o, $(shell find src/ -name *cpp)) - -.PHONY: all build-debug clean-debug doc - -all: - @echo "What to do master?" - -FORCE: - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# make subdir makefile - -%/makefile: makefile makefile.conf - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - echo "\ - SHELL:=/bin/bash$${NEW_LINE}\ - SRCDIR:=$${NEW_LINE}\ - $${NEW_LINE}\ - define NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - $${NEW_LINE}\ - endef$${NEW_LINE}\ - $${NEW_LINE}\ - export NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - CXXFLAGS:= -pipe -std=c++11 \$$(CXX_OTHER_FLAGS) -c $(CXX_FLAGS) -fPIC \$$(addprefix -I, \$$(realpath $(INCLUDE_PATHS)))$${NEW_LINE}\ - $${NEW_LINE}\ - SOURCES:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -type f -name \"*.cpp\")$${NEW_LINE}\ - DEPENDENCIES:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d, \$$(SOURCES))$${NEW_LINE}\ - OBJECTS:= \$$(patsubst %.d, %.o, \$$(DEPENDENCIES))$${NEW_LINE}\ - SOURCES_DIRS:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -mindepth 1 -type d)$${NEW_LINE}\ - OBJECTS_DIRS:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%, %/, \$$(SOURCES_DIRS))$${NEW_LINE}\ - OBJECTS_DIRS_MAKEFILES:= \$$(patsubst %, %makefile, \$$(OBJECTS_DIRS))$${NEW_LINE}\ - $${NEW_LINE}\ - .PHONY: all$${NEW_LINE}\ - .PRECIOUS: \$$(DEPENDECIES) \$$(OBJECTS_DIRS_MAKEFILES)$${NEW_LINE}\ - $${NEW_LINE}\ - all: \$$(OBJECTS_DIRS) \$$(OBJECTS)$${NEW_LINE}\ - $${NEW_LINE}\ - %.d: makefile$${NEW_LINE}\ - @echo \"\\$${NEW_LINE}\ - \$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\") = \\$$\$$(shell (\\$$\$$(CXX) -M \\$$\$$(CXXFLAGS) \$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) 2>/dev/null || echo \\\"\$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) FORCE\\\") | sed \\\"s/.*://g;s/\\\\\\\\\\\\\\\\//g\\\")\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \$$(patsubst %.d,%.o, \$$@): \\$$\$$(\$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\")) makefile\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \\$$\$$(CXX) \\$$\$$(CXXFLAGS) \\$$\$$< -o \$$(patsubst %.d,%.o, \$$@)\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \" > \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/makefile: makefile$${NEW_LINE}\ - mkdir -p \$$(dir \$$@)$${NEW_LINE}\ - cp makefile \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/: FORCE | %/makefile$${NEW_LINE}\ - @accesstime=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - \$$(MAKE) -C \$$@ SRCDIR=\$$(SRCDIR)\$$(notdir \$$(patsubst %/, %, \$$@))/ OBJECTS_BASE_DIR=\$$(OBJECTS_BASE_DIR) SOURCES_BASE_DIR=\$$(SOURCES_BASE_DIR) CXX_OTHER_FLAGS=\"\$$(CXX_OTHER_FLAGS)\" && \\$${NEW_LINE}\ - accesstime2=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - if [ "\$$\$$accesstime" -ne "\$$\$$accesstime2" ]; then \\$${NEW_LINE}\ - touch .; \\$${NEW_LINE}\ - fi$${NEW_LINE}\ - $${NEW_LINE}\ - FORCE:$${NEW_LINE}\ - $${NEW_LINE}\ - -include \$$(DEPENDENCIES)" > $@ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# final lib/bin construction - -bin-debug/$(EXECUTABLE): obj-debug/ $(OBJECTS_DEBUG) - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG) - -bin-release/$(EXECUTABLE): obj-release/ $(OBJECTS_RELEASE) - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# subdir make calls - -obj-debug/: FORCE | obj-debug/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-debug) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-g -Og -DDEBUG" - -obj-release/: FORCE | obj-release/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-release) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-O3 -DNDEBUG -DRELEASE $(LTO_PARAM)" - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# objects dependencies - -$(OBJECTS_DEBUG): obj-debug/ - -$(OBJECTS_RELEASE): obj-release/ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# standalone main targets - -build-code-debug: bin-debug/$(EXECUTABLE) - -build-code-release: bin-release/$(EXECUTABLE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# do all main targets - -debug: - $(MAKE) build-code-debug - -release: - $(MAKE) build-code-release - -clean: clean-debug clean-release - $(RM) -r doc - -clean-debug: - if [ -L obj-debug ]; then\ - $(RM) -r `readlink obj-debug`;\ - fi - if [ -L bin-debug ]; then\ - $(RM) -r `readlink bin-debug`;\ - fi - $(RM) -r *.o *.d bin-debug obj-debug - -clean-release: - if [ -L obj-release ]; then\ - $(RM) -r `readlink obj-release`;\ - fi - if [ -L lib-release ]; then\ - $(RM) -r `readlink lib-release`;\ - fi - $(RM) -r *.o *.d bin-release obj-release - -doc: - doxygen +-include ../build.conf +-include ../makefile-binary diff --git a/araw2/makefile b/araw2/makefile index 4064fd0131..bd9fb6f7bc 100644 --- a/araw2/makefile +++ b/araw2/makefile @@ -1,174 +1,3 @@ -SHELL:=/bin/bash - --include ../build.conf -include makefile.conf - -LTO_PARAM:= -ifeq ($(USE_LTO),1) -LTO_PARAM:= -flto -endif - -define NEW_LINE - - -endef - -export NEW_LINE - -CXX_FLAGS := -Wall -pedantic -Wextra -Werror -Wshadow -Wpointer-arith -Wcast-qual -Wdelete-non-virtual-dtor -Wredundant-decls - -LDFLAGS_DEBUG:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-debug, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) -Wl,-rpath,. - -LDFLAGS_RELEASE:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-release, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) $(LTO_PARAM) -Wl,-rpath,. - -OBJECTS_DEBUG:=$(patsubst src/%.cpp,obj-debug/%.o, $(shell find src/ -name *cpp)) - -OBJECTS_RELEASE:=$(patsubst src/%.cpp,obj-release/%.o, $(shell find src/ -name *cpp)) - -.PHONY: all build-debug clean-debug doc - -all: - @echo "What to do master?" - -FORCE: - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# make subdir makefile - -%/makefile: makefile makefile.conf - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - echo "\ - SHELL:=/bin/bash$${NEW_LINE}\ - SRCDIR:=$${NEW_LINE}\ - $${NEW_LINE}\ - define NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - $${NEW_LINE}\ - endef$${NEW_LINE}\ - $${NEW_LINE}\ - export NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - CXXFLAGS:= -pipe -std=c++11 \$$(CXX_OTHER_FLAGS) -c $(CXX_FLAGS) -fPIC \$$(addprefix -I, \$$(realpath $(INCLUDE_PATHS)))$${NEW_LINE}\ - $${NEW_LINE}\ - SOURCES:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -type f -name \"*.cpp\")$${NEW_LINE}\ - DEPENDENCIES:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d, \$$(SOURCES))$${NEW_LINE}\ - OBJECTS:= \$$(patsubst %.d, %.o, \$$(DEPENDENCIES))$${NEW_LINE}\ - SOURCES_DIRS:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -mindepth 1 -type d)$${NEW_LINE}\ - OBJECTS_DIRS:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%, %/, \$$(SOURCES_DIRS))$${NEW_LINE}\ - OBJECTS_DIRS_MAKEFILES:= \$$(patsubst %, %makefile, \$$(OBJECTS_DIRS))$${NEW_LINE}\ - $${NEW_LINE}\ - .PHONY: all$${NEW_LINE}\ - .PRECIOUS: \$$(DEPENDECIES) \$$(OBJECTS_DIRS_MAKEFILES)$${NEW_LINE}\ - $${NEW_LINE}\ - all: \$$(OBJECTS_DIRS) \$$(OBJECTS)$${NEW_LINE}\ - $${NEW_LINE}\ - %.d: makefile$${NEW_LINE}\ - @echo \"\\$${NEW_LINE}\ - \$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\") = \\$$\$$(shell (\\$$\$$(CXX) -M \\$$\$$(CXXFLAGS) \$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) 2>/dev/null || echo \\\"\$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) FORCE\\\") | sed \\\"s/.*://g;s/\\\\\\\\\\\\\\\\//g\\\")\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \$$(patsubst %.d,%.o, \$$@): \\$$\$$(\$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\")) makefile\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \\$$\$$(CXX) \\$$\$$(CXXFLAGS) \\$$\$$< -o \$$(patsubst %.d,%.o, \$$@)\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \" > \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/makefile: makefile$${NEW_LINE}\ - mkdir -p \$$(dir \$$@)$${NEW_LINE}\ - cp makefile \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/: FORCE | %/makefile$${NEW_LINE}\ - @accesstime=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - \$$(MAKE) -C \$$@ SRCDIR=\$$(SRCDIR)\$$(notdir \$$(patsubst %/, %, \$$@))/ OBJECTS_BASE_DIR=\$$(OBJECTS_BASE_DIR) SOURCES_BASE_DIR=\$$(SOURCES_BASE_DIR) CXX_OTHER_FLAGS=\"\$$(CXX_OTHER_FLAGS)\" && \\$${NEW_LINE}\ - accesstime2=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - if [ "\$$\$$accesstime" -ne "\$$\$$accesstime2" ]; then \\$${NEW_LINE}\ - touch .; \\$${NEW_LINE}\ - fi$${NEW_LINE}\ - $${NEW_LINE}\ - FORCE:$${NEW_LINE}\ - $${NEW_LINE}\ - -include \$$(DEPENDENCIES)" > $@ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# final lib/bin construction - -bin-debug/$(EXECUTABLE): obj-debug/ $(OBJECTS_DEBUG) - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG) - -bin-release/$(EXECUTABLE): obj-release/ $(OBJECTS_RELEASE) - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# subdir make calls - -obj-debug/: FORCE | obj-debug/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-debug) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-g -Og -DDEBUG" - -obj-release/: FORCE | obj-release/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-release) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-O3 -DNDEBUG -DRELEASE $(LTO_PARAM)" - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# objects dependencies - -$(OBJECTS_DEBUG): obj-debug/ - -$(OBJECTS_RELEASE): obj-release/ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# standalone main targets - -build-code-debug: bin-debug/$(EXECUTABLE) - -build-code-release: bin-release/$(EXECUTABLE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# do all main targets - -debug: - $(MAKE) build-code-debug - -release: - $(MAKE) build-code-release - -clean: clean-debug clean-release - $(RM) -r doc - -clean-debug: - if [ -L obj-debug ]; then\ - $(RM) -r `readlink obj-debug`;\ - fi - if [ -L bin-debug ]; then\ - $(RM) -r `readlink bin-debug`;\ - fi - $(RM) -r *.o *.d bin-debug obj-debug - -clean-release: - if [ -L obj-release ]; then\ - $(RM) -r `readlink obj-release`;\ - fi - if [ -L lib-release ]; then\ - $(RM) -r `readlink lib-release`;\ - fi - $(RM) -r *.o *.d bin-release obj-release - -doc: - doxygen +-include ../build.conf +-include ../makefile-binary diff --git a/arename2/makefile b/arename2/makefile index 4064fd0131..bd9fb6f7bc 100644 --- a/arename2/makefile +++ b/arename2/makefile @@ -1,174 +1,3 @@ -SHELL:=/bin/bash - --include ../build.conf -include makefile.conf - -LTO_PARAM:= -ifeq ($(USE_LTO),1) -LTO_PARAM:= -flto -endif - -define NEW_LINE - - -endef - -export NEW_LINE - -CXX_FLAGS := -Wall -pedantic -Wextra -Werror -Wshadow -Wpointer-arith -Wcast-qual -Wdelete-non-virtual-dtor -Wredundant-decls - -LDFLAGS_DEBUG:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-debug, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) -Wl,-rpath,. - -LDFLAGS_RELEASE:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-release, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) $(LTO_PARAM) -Wl,-rpath,. - -OBJECTS_DEBUG:=$(patsubst src/%.cpp,obj-debug/%.o, $(shell find src/ -name *cpp)) - -OBJECTS_RELEASE:=$(patsubst src/%.cpp,obj-release/%.o, $(shell find src/ -name *cpp)) - -.PHONY: all build-debug clean-debug doc - -all: - @echo "What to do master?" - -FORCE: - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# make subdir makefile - -%/makefile: makefile makefile.conf - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - echo "\ - SHELL:=/bin/bash$${NEW_LINE}\ - SRCDIR:=$${NEW_LINE}\ - $${NEW_LINE}\ - define NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - $${NEW_LINE}\ - endef$${NEW_LINE}\ - $${NEW_LINE}\ - export NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - CXXFLAGS:= -pipe -std=c++11 \$$(CXX_OTHER_FLAGS) -c $(CXX_FLAGS) -fPIC \$$(addprefix -I, \$$(realpath $(INCLUDE_PATHS)))$${NEW_LINE}\ - $${NEW_LINE}\ - SOURCES:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -type f -name \"*.cpp\")$${NEW_LINE}\ - DEPENDENCIES:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d, \$$(SOURCES))$${NEW_LINE}\ - OBJECTS:= \$$(patsubst %.d, %.o, \$$(DEPENDENCIES))$${NEW_LINE}\ - SOURCES_DIRS:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -mindepth 1 -type d)$${NEW_LINE}\ - OBJECTS_DIRS:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%, %/, \$$(SOURCES_DIRS))$${NEW_LINE}\ - OBJECTS_DIRS_MAKEFILES:= \$$(patsubst %, %makefile, \$$(OBJECTS_DIRS))$${NEW_LINE}\ - $${NEW_LINE}\ - .PHONY: all$${NEW_LINE}\ - .PRECIOUS: \$$(DEPENDECIES) \$$(OBJECTS_DIRS_MAKEFILES)$${NEW_LINE}\ - $${NEW_LINE}\ - all: \$$(OBJECTS_DIRS) \$$(OBJECTS)$${NEW_LINE}\ - $${NEW_LINE}\ - %.d: makefile$${NEW_LINE}\ - @echo \"\\$${NEW_LINE}\ - \$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\") = \\$$\$$(shell (\\$$\$$(CXX) -M \\$$\$$(CXXFLAGS) \$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) 2>/dev/null || echo \\\"\$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) FORCE\\\") | sed \\\"s/.*://g;s/\\\\\\\\\\\\\\\\//g\\\")\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \$$(patsubst %.d,%.o, \$$@): \\$$\$$(\$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\")) makefile\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \\$$\$$(CXX) \\$$\$$(CXXFLAGS) \\$$\$$< -o \$$(patsubst %.d,%.o, \$$@)\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \" > \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/makefile: makefile$${NEW_LINE}\ - mkdir -p \$$(dir \$$@)$${NEW_LINE}\ - cp makefile \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/: FORCE | %/makefile$${NEW_LINE}\ - @accesstime=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - \$$(MAKE) -C \$$@ SRCDIR=\$$(SRCDIR)\$$(notdir \$$(patsubst %/, %, \$$@))/ OBJECTS_BASE_DIR=\$$(OBJECTS_BASE_DIR) SOURCES_BASE_DIR=\$$(SOURCES_BASE_DIR) CXX_OTHER_FLAGS=\"\$$(CXX_OTHER_FLAGS)\" && \\$${NEW_LINE}\ - accesstime2=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - if [ "\$$\$$accesstime" -ne "\$$\$$accesstime2" ]; then \\$${NEW_LINE}\ - touch .; \\$${NEW_LINE}\ - fi$${NEW_LINE}\ - $${NEW_LINE}\ - FORCE:$${NEW_LINE}\ - $${NEW_LINE}\ - -include \$$(DEPENDENCIES)" > $@ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# final lib/bin construction - -bin-debug/$(EXECUTABLE): obj-debug/ $(OBJECTS_DEBUG) - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG) - -bin-release/$(EXECUTABLE): obj-release/ $(OBJECTS_RELEASE) - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# subdir make calls - -obj-debug/: FORCE | obj-debug/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-debug) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-g -Og -DDEBUG" - -obj-release/: FORCE | obj-release/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-release) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-O3 -DNDEBUG -DRELEASE $(LTO_PARAM)" - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# objects dependencies - -$(OBJECTS_DEBUG): obj-debug/ - -$(OBJECTS_RELEASE): obj-release/ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# standalone main targets - -build-code-debug: bin-debug/$(EXECUTABLE) - -build-code-release: bin-release/$(EXECUTABLE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# do all main targets - -debug: - $(MAKE) build-code-debug - -release: - $(MAKE) build-code-release - -clean: clean-debug clean-release - $(RM) -r doc - -clean-debug: - if [ -L obj-debug ]; then\ - $(RM) -r `readlink obj-debug`;\ - fi - if [ -L bin-debug ]; then\ - $(RM) -r `readlink bin-debug`;\ - fi - $(RM) -r *.o *.d bin-debug obj-debug - -clean-release: - if [ -L obj-release ]; then\ - $(RM) -r `readlink obj-release`;\ - fi - if [ -L lib-release ]; then\ - $(RM) -r `readlink lib-release`;\ - fi - $(RM) -r *.o *.d bin-release obj-release - -doc: - doxygen +-include ../build.conf +-include ../makefile-binary diff --git a/areverse2/makefile b/areverse2/makefile index 4064fd0131..bd9fb6f7bc 100644 --- a/areverse2/makefile +++ b/areverse2/makefile @@ -1,174 +1,3 @@ -SHELL:=/bin/bash - --include ../build.conf -include makefile.conf - -LTO_PARAM:= -ifeq ($(USE_LTO),1) -LTO_PARAM:= -flto -endif - -define NEW_LINE - - -endef - -export NEW_LINE - -CXX_FLAGS := -Wall -pedantic -Wextra -Werror -Wshadow -Wpointer-arith -Wcast-qual -Wdelete-non-virtual-dtor -Wredundant-decls - -LDFLAGS_DEBUG:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-debug, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) -Wl,-rpath,. - -LDFLAGS_RELEASE:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-release, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) $(LTO_PARAM) -Wl,-rpath,. - -OBJECTS_DEBUG:=$(patsubst src/%.cpp,obj-debug/%.o, $(shell find src/ -name *cpp)) - -OBJECTS_RELEASE:=$(patsubst src/%.cpp,obj-release/%.o, $(shell find src/ -name *cpp)) - -.PHONY: all build-debug clean-debug doc - -all: - @echo "What to do master?" - -FORCE: - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# make subdir makefile - -%/makefile: makefile makefile.conf - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - echo "\ - SHELL:=/bin/bash$${NEW_LINE}\ - SRCDIR:=$${NEW_LINE}\ - $${NEW_LINE}\ - define NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - $${NEW_LINE}\ - endef$${NEW_LINE}\ - $${NEW_LINE}\ - export NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - CXXFLAGS:= -pipe -std=c++11 \$$(CXX_OTHER_FLAGS) -c $(CXX_FLAGS) -fPIC \$$(addprefix -I, \$$(realpath $(INCLUDE_PATHS)))$${NEW_LINE}\ - $${NEW_LINE}\ - SOURCES:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -type f -name \"*.cpp\")$${NEW_LINE}\ - DEPENDENCIES:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d, \$$(SOURCES))$${NEW_LINE}\ - OBJECTS:= \$$(patsubst %.d, %.o, \$$(DEPENDENCIES))$${NEW_LINE}\ - SOURCES_DIRS:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -mindepth 1 -type d)$${NEW_LINE}\ - OBJECTS_DIRS:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%, %/, \$$(SOURCES_DIRS))$${NEW_LINE}\ - OBJECTS_DIRS_MAKEFILES:= \$$(patsubst %, %makefile, \$$(OBJECTS_DIRS))$${NEW_LINE}\ - $${NEW_LINE}\ - .PHONY: all$${NEW_LINE}\ - .PRECIOUS: \$$(DEPENDECIES) \$$(OBJECTS_DIRS_MAKEFILES)$${NEW_LINE}\ - $${NEW_LINE}\ - all: \$$(OBJECTS_DIRS) \$$(OBJECTS)$${NEW_LINE}\ - $${NEW_LINE}\ - %.d: makefile$${NEW_LINE}\ - @echo \"\\$${NEW_LINE}\ - \$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\") = \\$$\$$(shell (\\$$\$$(CXX) -M \\$$\$$(CXXFLAGS) \$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) 2>/dev/null || echo \\\"\$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) FORCE\\\") | sed \\\"s/.*://g;s/\\\\\\\\\\\\\\\\//g\\\")\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \$$(patsubst %.d,%.o, \$$@): \\$$\$$(\$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\")) makefile\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \\$$\$$(CXX) \\$$\$$(CXXFLAGS) \\$$\$$< -o \$$(patsubst %.d,%.o, \$$@)\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \" > \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/makefile: makefile$${NEW_LINE}\ - mkdir -p \$$(dir \$$@)$${NEW_LINE}\ - cp makefile \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/: FORCE | %/makefile$${NEW_LINE}\ - @accesstime=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - \$$(MAKE) -C \$$@ SRCDIR=\$$(SRCDIR)\$$(notdir \$$(patsubst %/, %, \$$@))/ OBJECTS_BASE_DIR=\$$(OBJECTS_BASE_DIR) SOURCES_BASE_DIR=\$$(SOURCES_BASE_DIR) CXX_OTHER_FLAGS=\"\$$(CXX_OTHER_FLAGS)\" && \\$${NEW_LINE}\ - accesstime2=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - if [ "\$$\$$accesstime" -ne "\$$\$$accesstime2" ]; then \\$${NEW_LINE}\ - touch .; \\$${NEW_LINE}\ - fi$${NEW_LINE}\ - $${NEW_LINE}\ - FORCE:$${NEW_LINE}\ - $${NEW_LINE}\ - -include \$$(DEPENDENCIES)" > $@ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# final lib/bin construction - -bin-debug/$(EXECUTABLE): obj-debug/ $(OBJECTS_DEBUG) - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG) - -bin-release/$(EXECUTABLE): obj-release/ $(OBJECTS_RELEASE) - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# subdir make calls - -obj-debug/: FORCE | obj-debug/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-debug) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-g -Og -DDEBUG" - -obj-release/: FORCE | obj-release/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-release) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-O3 -DNDEBUG -DRELEASE $(LTO_PARAM)" - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# objects dependencies - -$(OBJECTS_DEBUG): obj-debug/ - -$(OBJECTS_RELEASE): obj-release/ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# standalone main targets - -build-code-debug: bin-debug/$(EXECUTABLE) - -build-code-release: bin-release/$(EXECUTABLE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# do all main targets - -debug: - $(MAKE) build-code-debug - -release: - $(MAKE) build-code-release - -clean: clean-debug clean-release - $(RM) -r doc - -clean-debug: - if [ -L obj-debug ]; then\ - $(RM) -r `readlink obj-debug`;\ - fi - if [ -L bin-debug ]; then\ - $(RM) -r `readlink bin-debug`;\ - fi - $(RM) -r *.o *.d bin-debug obj-debug - -clean-release: - if [ -L obj-release ]; then\ - $(RM) -r `readlink obj-release`;\ - fi - if [ -L lib-release ]; then\ - $(RM) -r `readlink lib-release`;\ - fi - $(RM) -r *.o *.d bin-release obj-release - -doc: - doxygen +-include ../build.conf +-include ../makefile-binary diff --git a/arun2/makefile b/arun2/makefile index 4064fd0131..bd9fb6f7bc 100644 --- a/arun2/makefile +++ b/arun2/makefile @@ -1,174 +1,3 @@ -SHELL:=/bin/bash - --include ../build.conf -include makefile.conf - -LTO_PARAM:= -ifeq ($(USE_LTO),1) -LTO_PARAM:= -flto -endif - -define NEW_LINE - - -endef - -export NEW_LINE - -CXX_FLAGS := -Wall -pedantic -Wextra -Werror -Wshadow -Wpointer-arith -Wcast-qual -Wdelete-non-virtual-dtor -Wredundant-decls - -LDFLAGS_DEBUG:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-debug, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) -Wl,-rpath,. - -LDFLAGS_RELEASE:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-release, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) $(LTO_PARAM) -Wl,-rpath,. - -OBJECTS_DEBUG:=$(patsubst src/%.cpp,obj-debug/%.o, $(shell find src/ -name *cpp)) - -OBJECTS_RELEASE:=$(patsubst src/%.cpp,obj-release/%.o, $(shell find src/ -name *cpp)) - -.PHONY: all build-debug clean-debug doc - -all: - @echo "What to do master?" - -FORCE: - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# make subdir makefile - -%/makefile: makefile makefile.conf - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - echo "\ - SHELL:=/bin/bash$${NEW_LINE}\ - SRCDIR:=$${NEW_LINE}\ - $${NEW_LINE}\ - define NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - $${NEW_LINE}\ - endef$${NEW_LINE}\ - $${NEW_LINE}\ - export NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - CXXFLAGS:= -pipe -std=c++11 \$$(CXX_OTHER_FLAGS) -c $(CXX_FLAGS) -fPIC \$$(addprefix -I, \$$(realpath $(INCLUDE_PATHS)))$${NEW_LINE}\ - $${NEW_LINE}\ - SOURCES:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -type f -name \"*.cpp\")$${NEW_LINE}\ - DEPENDENCIES:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d, \$$(SOURCES))$${NEW_LINE}\ - OBJECTS:= \$$(patsubst %.d, %.o, \$$(DEPENDENCIES))$${NEW_LINE}\ - SOURCES_DIRS:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -mindepth 1 -type d)$${NEW_LINE}\ - OBJECTS_DIRS:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%, %/, \$$(SOURCES_DIRS))$${NEW_LINE}\ - OBJECTS_DIRS_MAKEFILES:= \$$(patsubst %, %makefile, \$$(OBJECTS_DIRS))$${NEW_LINE}\ - $${NEW_LINE}\ - .PHONY: all$${NEW_LINE}\ - .PRECIOUS: \$$(DEPENDECIES) \$$(OBJECTS_DIRS_MAKEFILES)$${NEW_LINE}\ - $${NEW_LINE}\ - all: \$$(OBJECTS_DIRS) \$$(OBJECTS)$${NEW_LINE}\ - $${NEW_LINE}\ - %.d: makefile$${NEW_LINE}\ - @echo \"\\$${NEW_LINE}\ - \$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\") = \\$$\$$(shell (\\$$\$$(CXX) -M \\$$\$$(CXXFLAGS) \$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) 2>/dev/null || echo \\\"\$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) FORCE\\\") | sed \\\"s/.*://g;s/\\\\\\\\\\\\\\\\//g\\\")\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \$$(patsubst %.d,%.o, \$$@): \\$$\$$(\$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\")) makefile\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \\$$\$$(CXX) \\$$\$$(CXXFLAGS) \\$$\$$< -o \$$(patsubst %.d,%.o, \$$@)\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \" > \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/makefile: makefile$${NEW_LINE}\ - mkdir -p \$$(dir \$$@)$${NEW_LINE}\ - cp makefile \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/: FORCE | %/makefile$${NEW_LINE}\ - @accesstime=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - \$$(MAKE) -C \$$@ SRCDIR=\$$(SRCDIR)\$$(notdir \$$(patsubst %/, %, \$$@))/ OBJECTS_BASE_DIR=\$$(OBJECTS_BASE_DIR) SOURCES_BASE_DIR=\$$(SOURCES_BASE_DIR) CXX_OTHER_FLAGS=\"\$$(CXX_OTHER_FLAGS)\" && \\$${NEW_LINE}\ - accesstime2=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - if [ "\$$\$$accesstime" -ne "\$$\$$accesstime2" ]; then \\$${NEW_LINE}\ - touch .; \\$${NEW_LINE}\ - fi$${NEW_LINE}\ - $${NEW_LINE}\ - FORCE:$${NEW_LINE}\ - $${NEW_LINE}\ - -include \$$(DEPENDENCIES)" > $@ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# final lib/bin construction - -bin-debug/$(EXECUTABLE): obj-debug/ $(OBJECTS_DEBUG) - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG) - -bin-release/$(EXECUTABLE): obj-release/ $(OBJECTS_RELEASE) - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# subdir make calls - -obj-debug/: FORCE | obj-debug/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-debug) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-g -Og -DDEBUG" - -obj-release/: FORCE | obj-release/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-release) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-O3 -DNDEBUG -DRELEASE $(LTO_PARAM)" - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# objects dependencies - -$(OBJECTS_DEBUG): obj-debug/ - -$(OBJECTS_RELEASE): obj-release/ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# standalone main targets - -build-code-debug: bin-debug/$(EXECUTABLE) - -build-code-release: bin-release/$(EXECUTABLE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# do all main targets - -debug: - $(MAKE) build-code-debug - -release: - $(MAKE) build-code-release - -clean: clean-debug clean-release - $(RM) -r doc - -clean-debug: - if [ -L obj-debug ]; then\ - $(RM) -r `readlink obj-debug`;\ - fi - if [ -L bin-debug ]; then\ - $(RM) -r `readlink bin-debug`;\ - fi - $(RM) -r *.o *.d bin-debug obj-debug - -clean-release: - if [ -L obj-release ]; then\ - $(RM) -r `readlink obj-release`;\ - fi - if [ -L lib-release ]; then\ - $(RM) -r `readlink lib-release`;\ - fi - $(RM) -r *.o *.d bin-release obj-release - -doc: - doxygen +-include ../build.conf +-include ../makefile-binary diff --git a/astat2/makefile b/astat2/makefile index 4064fd0131..bd9fb6f7bc 100644 --- a/astat2/makefile +++ b/astat2/makefile @@ -1,174 +1,3 @@ -SHELL:=/bin/bash - --include ../build.conf -include makefile.conf - -LTO_PARAM:= -ifeq ($(USE_LTO),1) -LTO_PARAM:= -flto -endif - -define NEW_LINE - - -endef - -export NEW_LINE - -CXX_FLAGS := -Wall -pedantic -Wextra -Werror -Wshadow -Wpointer-arith -Wcast-qual -Wdelete-non-virtual-dtor -Wredundant-decls - -LDFLAGS_DEBUG:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-debug, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) -Wl,-rpath,. - -LDFLAGS_RELEASE:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-release, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) $(LTO_PARAM) -Wl,-rpath,. - -OBJECTS_DEBUG:=$(patsubst src/%.cpp,obj-debug/%.o, $(shell find src/ -name *cpp)) - -OBJECTS_RELEASE:=$(patsubst src/%.cpp,obj-release/%.o, $(shell find src/ -name *cpp)) - -.PHONY: all build-debug clean-debug doc - -all: - @echo "What to do master?" - -FORCE: - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# make subdir makefile - -%/makefile: makefile makefile.conf - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - echo "\ - SHELL:=/bin/bash$${NEW_LINE}\ - SRCDIR:=$${NEW_LINE}\ - $${NEW_LINE}\ - define NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - $${NEW_LINE}\ - endef$${NEW_LINE}\ - $${NEW_LINE}\ - export NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - CXXFLAGS:= -pipe -std=c++11 \$$(CXX_OTHER_FLAGS) -c $(CXX_FLAGS) -fPIC \$$(addprefix -I, \$$(realpath $(INCLUDE_PATHS)))$${NEW_LINE}\ - $${NEW_LINE}\ - SOURCES:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -type f -name \"*.cpp\")$${NEW_LINE}\ - DEPENDENCIES:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d, \$$(SOURCES))$${NEW_LINE}\ - OBJECTS:= \$$(patsubst %.d, %.o, \$$(DEPENDENCIES))$${NEW_LINE}\ - SOURCES_DIRS:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -mindepth 1 -type d)$${NEW_LINE}\ - OBJECTS_DIRS:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%, %/, \$$(SOURCES_DIRS))$${NEW_LINE}\ - OBJECTS_DIRS_MAKEFILES:= \$$(patsubst %, %makefile, \$$(OBJECTS_DIRS))$${NEW_LINE}\ - $${NEW_LINE}\ - .PHONY: all$${NEW_LINE}\ - .PRECIOUS: \$$(DEPENDECIES) \$$(OBJECTS_DIRS_MAKEFILES)$${NEW_LINE}\ - $${NEW_LINE}\ - all: \$$(OBJECTS_DIRS) \$$(OBJECTS)$${NEW_LINE}\ - $${NEW_LINE}\ - %.d: makefile$${NEW_LINE}\ - @echo \"\\$${NEW_LINE}\ - \$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\") = \\$$\$$(shell (\\$$\$$(CXX) -M \\$$\$$(CXXFLAGS) \$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) 2>/dev/null || echo \\\"\$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) FORCE\\\") | sed \\\"s/.*://g;s/\\\\\\\\\\\\\\\\//g\\\")\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \$$(patsubst %.d,%.o, \$$@): \\$$\$$(\$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\")) makefile\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \\$$\$$(CXX) \\$$\$$(CXXFLAGS) \\$$\$$< -o \$$(patsubst %.d,%.o, \$$@)\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \" > \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/makefile: makefile$${NEW_LINE}\ - mkdir -p \$$(dir \$$@)$${NEW_LINE}\ - cp makefile \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/: FORCE | %/makefile$${NEW_LINE}\ - @accesstime=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - \$$(MAKE) -C \$$@ SRCDIR=\$$(SRCDIR)\$$(notdir \$$(patsubst %/, %, \$$@))/ OBJECTS_BASE_DIR=\$$(OBJECTS_BASE_DIR) SOURCES_BASE_DIR=\$$(SOURCES_BASE_DIR) CXX_OTHER_FLAGS=\"\$$(CXX_OTHER_FLAGS)\" && \\$${NEW_LINE}\ - accesstime2=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - if [ "\$$\$$accesstime" -ne "\$$\$$accesstime2" ]; then \\$${NEW_LINE}\ - touch .; \\$${NEW_LINE}\ - fi$${NEW_LINE}\ - $${NEW_LINE}\ - FORCE:$${NEW_LINE}\ - $${NEW_LINE}\ - -include \$$(DEPENDENCIES)" > $@ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# final lib/bin construction - -bin-debug/$(EXECUTABLE): obj-debug/ $(OBJECTS_DEBUG) - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG) - -bin-release/$(EXECUTABLE): obj-release/ $(OBJECTS_RELEASE) - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# subdir make calls - -obj-debug/: FORCE | obj-debug/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-debug) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-g -Og -DDEBUG" - -obj-release/: FORCE | obj-release/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-release) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-O3 -DNDEBUG -DRELEASE $(LTO_PARAM)" - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# objects dependencies - -$(OBJECTS_DEBUG): obj-debug/ - -$(OBJECTS_RELEASE): obj-release/ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# standalone main targets - -build-code-debug: bin-debug/$(EXECUTABLE) - -build-code-release: bin-release/$(EXECUTABLE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# do all main targets - -debug: - $(MAKE) build-code-debug - -release: - $(MAKE) build-code-release - -clean: clean-debug clean-release - $(RM) -r doc - -clean-debug: - if [ -L obj-debug ]; then\ - $(RM) -r `readlink obj-debug`;\ - fi - if [ -L bin-debug ]; then\ - $(RM) -r `readlink bin-debug`;\ - fi - $(RM) -r *.o *.d bin-debug obj-debug - -clean-release: - if [ -L obj-release ]; then\ - $(RM) -r `readlink obj-release`;\ - fi - if [ -L lib-release ]; then\ - $(RM) -r `readlink lib-release`;\ - fi - $(RM) -r *.o *.d bin-release obj-release - -doc: - doxygen +-include ../build.conf +-include ../makefile-binary diff --git a/astringology2/makefile b/astringology2/makefile index 4064fd0131..bd9fb6f7bc 100644 --- a/astringology2/makefile +++ b/astringology2/makefile @@ -1,174 +1,3 @@ -SHELL:=/bin/bash - --include ../build.conf -include makefile.conf - -LTO_PARAM:= -ifeq ($(USE_LTO),1) -LTO_PARAM:= -flto -endif - -define NEW_LINE - - -endef - -export NEW_LINE - -CXX_FLAGS := -Wall -pedantic -Wextra -Werror -Wshadow -Wpointer-arith -Wcast-qual -Wdelete-non-virtual-dtor -Wredundant-decls - -LDFLAGS_DEBUG:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-debug, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) -Wl,-rpath,. - -LDFLAGS_RELEASE:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-release, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) $(LTO_PARAM) -Wl,-rpath,. - -OBJECTS_DEBUG:=$(patsubst src/%.cpp,obj-debug/%.o, $(shell find src/ -name *cpp)) - -OBJECTS_RELEASE:=$(patsubst src/%.cpp,obj-release/%.o, $(shell find src/ -name *cpp)) - -.PHONY: all build-debug clean-debug doc - -all: - @echo "What to do master?" - -FORCE: - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# make subdir makefile - -%/makefile: makefile makefile.conf - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - echo "\ - SHELL:=/bin/bash$${NEW_LINE}\ - SRCDIR:=$${NEW_LINE}\ - $${NEW_LINE}\ - define NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - $${NEW_LINE}\ - endef$${NEW_LINE}\ - $${NEW_LINE}\ - export NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - CXXFLAGS:= -pipe -std=c++11 \$$(CXX_OTHER_FLAGS) -c $(CXX_FLAGS) -fPIC \$$(addprefix -I, \$$(realpath $(INCLUDE_PATHS)))$${NEW_LINE}\ - $${NEW_LINE}\ - SOURCES:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -type f -name \"*.cpp\")$${NEW_LINE}\ - DEPENDENCIES:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d, \$$(SOURCES))$${NEW_LINE}\ - OBJECTS:= \$$(patsubst %.d, %.o, \$$(DEPENDENCIES))$${NEW_LINE}\ - SOURCES_DIRS:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -mindepth 1 -type d)$${NEW_LINE}\ - OBJECTS_DIRS:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%, %/, \$$(SOURCES_DIRS))$${NEW_LINE}\ - OBJECTS_DIRS_MAKEFILES:= \$$(patsubst %, %makefile, \$$(OBJECTS_DIRS))$${NEW_LINE}\ - $${NEW_LINE}\ - .PHONY: all$${NEW_LINE}\ - .PRECIOUS: \$$(DEPENDECIES) \$$(OBJECTS_DIRS_MAKEFILES)$${NEW_LINE}\ - $${NEW_LINE}\ - all: \$$(OBJECTS_DIRS) \$$(OBJECTS)$${NEW_LINE}\ - $${NEW_LINE}\ - %.d: makefile$${NEW_LINE}\ - @echo \"\\$${NEW_LINE}\ - \$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\") = \\$$\$$(shell (\\$$\$$(CXX) -M \\$$\$$(CXXFLAGS) \$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) 2>/dev/null || echo \\\"\$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) FORCE\\\") | sed \\\"s/.*://g;s/\\\\\\\\\\\\\\\\//g\\\")\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \$$(patsubst %.d,%.o, \$$@): \\$$\$$(\$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\")) makefile\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \\$$\$$(CXX) \\$$\$$(CXXFLAGS) \\$$\$$< -o \$$(patsubst %.d,%.o, \$$@)\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \" > \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/makefile: makefile$${NEW_LINE}\ - mkdir -p \$$(dir \$$@)$${NEW_LINE}\ - cp makefile \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/: FORCE | %/makefile$${NEW_LINE}\ - @accesstime=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - \$$(MAKE) -C \$$@ SRCDIR=\$$(SRCDIR)\$$(notdir \$$(patsubst %/, %, \$$@))/ OBJECTS_BASE_DIR=\$$(OBJECTS_BASE_DIR) SOURCES_BASE_DIR=\$$(SOURCES_BASE_DIR) CXX_OTHER_FLAGS=\"\$$(CXX_OTHER_FLAGS)\" && \\$${NEW_LINE}\ - accesstime2=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - if [ "\$$\$$accesstime" -ne "\$$\$$accesstime2" ]; then \\$${NEW_LINE}\ - touch .; \\$${NEW_LINE}\ - fi$${NEW_LINE}\ - $${NEW_LINE}\ - FORCE:$${NEW_LINE}\ - $${NEW_LINE}\ - -include \$$(DEPENDENCIES)" > $@ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# final lib/bin construction - -bin-debug/$(EXECUTABLE): obj-debug/ $(OBJECTS_DEBUG) - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG) - -bin-release/$(EXECUTABLE): obj-release/ $(OBJECTS_RELEASE) - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# subdir make calls - -obj-debug/: FORCE | obj-debug/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-debug) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-g -Og -DDEBUG" - -obj-release/: FORCE | obj-release/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-release) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-O3 -DNDEBUG -DRELEASE $(LTO_PARAM)" - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# objects dependencies - -$(OBJECTS_DEBUG): obj-debug/ - -$(OBJECTS_RELEASE): obj-release/ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# standalone main targets - -build-code-debug: bin-debug/$(EXECUTABLE) - -build-code-release: bin-release/$(EXECUTABLE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# do all main targets - -debug: - $(MAKE) build-code-debug - -release: - $(MAKE) build-code-release - -clean: clean-debug clean-release - $(RM) -r doc - -clean-debug: - if [ -L obj-debug ]; then\ - $(RM) -r `readlink obj-debug`;\ - fi - if [ -L bin-debug ]; then\ - $(RM) -r `readlink bin-debug`;\ - fi - $(RM) -r *.o *.d bin-debug obj-debug - -clean-release: - if [ -L obj-release ]; then\ - $(RM) -r `readlink obj-release`;\ - fi - if [ -L lib-release ]; then\ - $(RM) -r `readlink lib-release`;\ - fi - $(RM) -r *.o *.d bin-release obj-release - -doc: - doxygen +-include ../build.conf +-include ../makefile-binary diff --git a/atrim2/makefile b/atrim2/makefile index 4064fd0131..bd9fb6f7bc 100644 --- a/atrim2/makefile +++ b/atrim2/makefile @@ -1,174 +1,3 @@ -SHELL:=/bin/bash - --include ../build.conf -include makefile.conf - -LTO_PARAM:= -ifeq ($(USE_LTO),1) -LTO_PARAM:= -flto -endif - -define NEW_LINE - - -endef - -export NEW_LINE - -CXX_FLAGS := -Wall -pedantic -Wextra -Werror -Wshadow -Wpointer-arith -Wcast-qual -Wdelete-non-virtual-dtor -Wredundant-decls - -LDFLAGS_DEBUG:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-debug, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) -Wl,-rpath,. - -LDFLAGS_RELEASE:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-release, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) $(LTO_PARAM) -Wl,-rpath,. - -OBJECTS_DEBUG:=$(patsubst src/%.cpp,obj-debug/%.o, $(shell find src/ -name *cpp)) - -OBJECTS_RELEASE:=$(patsubst src/%.cpp,obj-release/%.o, $(shell find src/ -name *cpp)) - -.PHONY: all build-debug clean-debug doc - -all: - @echo "What to do master?" - -FORCE: - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# make subdir makefile - -%/makefile: makefile makefile.conf - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - echo "\ - SHELL:=/bin/bash$${NEW_LINE}\ - SRCDIR:=$${NEW_LINE}\ - $${NEW_LINE}\ - define NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - $${NEW_LINE}\ - endef$${NEW_LINE}\ - $${NEW_LINE}\ - export NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - CXXFLAGS:= -pipe -std=c++11 \$$(CXX_OTHER_FLAGS) -c $(CXX_FLAGS) -fPIC \$$(addprefix -I, \$$(realpath $(INCLUDE_PATHS)))$${NEW_LINE}\ - $${NEW_LINE}\ - SOURCES:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -type f -name \"*.cpp\")$${NEW_LINE}\ - DEPENDENCIES:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d, \$$(SOURCES))$${NEW_LINE}\ - OBJECTS:= \$$(patsubst %.d, %.o, \$$(DEPENDENCIES))$${NEW_LINE}\ - SOURCES_DIRS:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -mindepth 1 -type d)$${NEW_LINE}\ - OBJECTS_DIRS:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%, %/, \$$(SOURCES_DIRS))$${NEW_LINE}\ - OBJECTS_DIRS_MAKEFILES:= \$$(patsubst %, %makefile, \$$(OBJECTS_DIRS))$${NEW_LINE}\ - $${NEW_LINE}\ - .PHONY: all$${NEW_LINE}\ - .PRECIOUS: \$$(DEPENDECIES) \$$(OBJECTS_DIRS_MAKEFILES)$${NEW_LINE}\ - $${NEW_LINE}\ - all: \$$(OBJECTS_DIRS) \$$(OBJECTS)$${NEW_LINE}\ - $${NEW_LINE}\ - %.d: makefile$${NEW_LINE}\ - @echo \"\\$${NEW_LINE}\ - \$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\") = \\$$\$$(shell (\\$$\$$(CXX) -M \\$$\$$(CXXFLAGS) \$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) 2>/dev/null || echo \\\"\$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) FORCE\\\") | sed \\\"s/.*://g;s/\\\\\\\\\\\\\\\\//g\\\")\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \$$(patsubst %.d,%.o, \$$@): \\$$\$$(\$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\")) makefile\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \\$$\$$(CXX) \\$$\$$(CXXFLAGS) \\$$\$$< -o \$$(patsubst %.d,%.o, \$$@)\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \" > \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/makefile: makefile$${NEW_LINE}\ - mkdir -p \$$(dir \$$@)$${NEW_LINE}\ - cp makefile \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/: FORCE | %/makefile$${NEW_LINE}\ - @accesstime=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - \$$(MAKE) -C \$$@ SRCDIR=\$$(SRCDIR)\$$(notdir \$$(patsubst %/, %, \$$@))/ OBJECTS_BASE_DIR=\$$(OBJECTS_BASE_DIR) SOURCES_BASE_DIR=\$$(SOURCES_BASE_DIR) CXX_OTHER_FLAGS=\"\$$(CXX_OTHER_FLAGS)\" && \\$${NEW_LINE}\ - accesstime2=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - if [ "\$$\$$accesstime" -ne "\$$\$$accesstime2" ]; then \\$${NEW_LINE}\ - touch .; \\$${NEW_LINE}\ - fi$${NEW_LINE}\ - $${NEW_LINE}\ - FORCE:$${NEW_LINE}\ - $${NEW_LINE}\ - -include \$$(DEPENDENCIES)" > $@ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# final lib/bin construction - -bin-debug/$(EXECUTABLE): obj-debug/ $(OBJECTS_DEBUG) - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG) - -bin-release/$(EXECUTABLE): obj-release/ $(OBJECTS_RELEASE) - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# subdir make calls - -obj-debug/: FORCE | obj-debug/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-debug) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-g -Og -DDEBUG" - -obj-release/: FORCE | obj-release/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-release) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-O3 -DNDEBUG -DRELEASE $(LTO_PARAM)" - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# objects dependencies - -$(OBJECTS_DEBUG): obj-debug/ - -$(OBJECTS_RELEASE): obj-release/ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# standalone main targets - -build-code-debug: bin-debug/$(EXECUTABLE) - -build-code-release: bin-release/$(EXECUTABLE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# do all main targets - -debug: - $(MAKE) build-code-debug - -release: - $(MAKE) build-code-release - -clean: clean-debug clean-release - $(RM) -r doc - -clean-debug: - if [ -L obj-debug ]; then\ - $(RM) -r `readlink obj-debug`;\ - fi - if [ -L bin-debug ]; then\ - $(RM) -r `readlink bin-debug`;\ - fi - $(RM) -r *.o *.d bin-debug obj-debug - -clean-release: - if [ -L obj-release ]; then\ - $(RM) -r `readlink obj-release`;\ - fi - if [ -L lib-release ]; then\ - $(RM) -r `readlink lib-release`;\ - fi - $(RM) -r *.o *.d bin-release obj-release - -doc: - doxygen +-include ../build.conf +-include ../makefile-binary diff --git a/makefile-binary b/makefile-binary new file mode 100644 index 0000000000..ed9ff50133 --- /dev/null +++ b/makefile-binary @@ -0,0 +1,171 @@ +SHELL:=/bin/bash + +LTO_PARAM:= +ifeq ($(USE_LTO),1) +LTO_PARAM:=-flto +endif + +define NEW_LINE + + +endef + +export NEW_LINE + +CXX_FLAGS := -Wall -pedantic -Wextra -Werror -Wshadow -Wpointer-arith -Wcast-qual -Wdelete-non-virtual-dtor -Wredundant-decls + +LDFLAGS_DEBUG:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-debug, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) -Wl,-rpath,. + +LDFLAGS_RELEASE:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-release, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) $(LTO_PARAM) -Wl,-rpath,. + +OBJECTS_DEBUG:=$(patsubst src/%.cpp,obj-debug/%.o, $(shell find src/ -name *cpp)) + +OBJECTS_RELEASE:=$(patsubst src/%.cpp,obj-release/%.o, $(shell find src/ -name *cpp)) + +.PHONY: all build-debug clean-debug doc + +all: + @echo "What to do master?" + +FORCE: + +# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +# make subdir makefile + +%/makefile: makefile makefile.conf + if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ + ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ + fi;\ + if [ -L $(subst /,, $(dir $@)) ]; then\ + mkdir -p `readlink $(subst /,, $(dir $@))`;\ + else\ + mkdir -p $(dir $@);\ + fi + echo "\ + SHELL:=/bin/bash$${NEW_LINE}\ + SRCDIR:=$${NEW_LINE}\ + $${NEW_LINE}\ + define NEW_LINE$${NEW_LINE}\ + $${NEW_LINE}\ + $${NEW_LINE}\ + endef$${NEW_LINE}\ + $${NEW_LINE}\ + export NEW_LINE$${NEW_LINE}\ + $${NEW_LINE}\ + CXXFLAGS:= -pipe -std=c++11 \$$(CXX_OTHER_FLAGS) -c $(CXX_FLAGS) -fPIC \$$(addprefix -I, \$$(realpath $(INCLUDE_PATHS)))$${NEW_LINE}\ + $${NEW_LINE}\ + SOURCES:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -type f -name \"*.cpp\")$${NEW_LINE}\ + DEPENDENCIES:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d, \$$(SOURCES))$${NEW_LINE}\ + OBJECTS:= \$$(patsubst %.d, %.o, \$$(DEPENDENCIES))$${NEW_LINE}\ + SOURCES_DIRS:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -mindepth 1 -type d)$${NEW_LINE}\ + OBJECTS_DIRS:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%, %/, \$$(SOURCES_DIRS))$${NEW_LINE}\ + OBJECTS_DIRS_MAKEFILES:= \$$(patsubst %, %makefile, \$$(OBJECTS_DIRS))$${NEW_LINE}\ + $${NEW_LINE}\ + .PHONY: all$${NEW_LINE}\ + .PRECIOUS: \$$(DEPENDECIES) \$$(OBJECTS_DIRS_MAKEFILES)$${NEW_LINE}\ + $${NEW_LINE}\ + all: \$$(OBJECTS_DIRS) \$$(OBJECTS)$${NEW_LINE}\ + $${NEW_LINE}\ + %.d: makefile$${NEW_LINE}\ + @echo \"\\$${NEW_LINE}\ + \$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\") = \\$$\$$(shell (\\$$\$$(CXX) -M \\$$\$$(CXXFLAGS) \$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) 2>/dev/null || echo \\\"\$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) FORCE\\\") | sed \\\"s/.*://g;s/\\\\\\\\\\\\\\\\//g\\\")\$$\$${NEW_LINE}\\$${NEW_LINE}\ + \$$(patsubst %.d,%.o, \$$@): \\$$\$$(\$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\")) makefile\$$\$${NEW_LINE}\\$${NEW_LINE}\ + \\$$\$$(CXX) \\$$\$$(CXXFLAGS) \\$$\$$< -o \$$(patsubst %.d,%.o, \$$@)\$$\$${NEW_LINE}\\$${NEW_LINE}\ + \" > \$$@$${NEW_LINE}\ + $${NEW_LINE}\ + %/makefile: makefile$${NEW_LINE}\ + mkdir -p \$$(dir \$$@)$${NEW_LINE}\ + cp makefile \$$@$${NEW_LINE}\ + $${NEW_LINE}\ + %/: FORCE | %/makefile$${NEW_LINE}\ + @accesstime=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ + \$$(MAKE) -C \$$@ SRCDIR=\$$(SRCDIR)\$$(notdir \$$(patsubst %/, %, \$$@))/ OBJECTS_BASE_DIR=\$$(OBJECTS_BASE_DIR) SOURCES_BASE_DIR=\$$(SOURCES_BASE_DIR) CXX_OTHER_FLAGS=\"\$$(CXX_OTHER_FLAGS)\" && \\$${NEW_LINE}\ + accesstime2=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ + if [ "\$$\$$accesstime" -ne "\$$\$$accesstime2" ]; then \\$${NEW_LINE}\ + touch .; \\$${NEW_LINE}\ + fi$${NEW_LINE}\ + $${NEW_LINE}\ + FORCE:$${NEW_LINE}\ + $${NEW_LINE}\ + -include \$$(DEPENDENCIES)" > $@ + +# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +# final lib/bin construction + +bin-debug/$(EXECUTABLE): obj-debug/ $(OBJECTS_DEBUG) + if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ + ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ + fi;\ + if [ -L $(subst /,, $(dir $@)) ]; then\ + mkdir -p `readlink $(subst /,, $(dir $@))`;\ + else\ + mkdir -p $(dir $@);\ + fi + $(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG) + +bin-release/$(EXECUTABLE): obj-release/ $(OBJECTS_RELEASE) + if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ + ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ + fi;\ + if [ -L $(subst /,, $(dir $@)) ]; then\ + mkdir -p `readlink $(subst /,, $(dir $@))`;\ + else\ + mkdir -p $(dir $@);\ + fi + $(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE) + +# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +# subdir make calls + +obj-debug/: FORCE | obj-debug/makefile + $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-debug) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-g -Og -DDEBUG" + +obj-release/: FORCE | obj-release/makefile + $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-release) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-O3 -DNDEBUG -DRELEASE $(LTO_PARAM)" + +# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +# objects dependencies + +$(OBJECTS_DEBUG): obj-debug/ + +$(OBJECTS_RELEASE): obj-release/ + +# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +# standalone main targets + +build-code-debug: bin-debug/$(EXECUTABLE) + +build-code-release: bin-release/$(EXECUTABLE) + +# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +# do all main targets + +debug: + $(MAKE) build-code-debug + +release: + $(MAKE) build-code-release + +clean: clean-debug clean-release + $(RM) -r doc + +clean-debug: + if [ -L obj-debug ]; then\ + $(RM) -r `readlink obj-debug`;\ + fi + if [ -L bin-debug ]; then\ + $(RM) -r `readlink bin-debug`;\ + fi + $(RM) -r *.o *.d bin-debug obj-debug + +clean-release: + if [ -L obj-release ]; then\ + $(RM) -r `readlink obj-release`;\ + fi + if [ -L lib-release ]; then\ + $(RM) -r `readlink lib-release`;\ + fi + $(RM) -r *.o *.d bin-release obj-release + +doc: + doxygen diff --git a/makefile-library b/makefile-library new file mode 100644 index 0000000000..f98e877b96 --- /dev/null +++ b/makefile-library @@ -0,0 +1,236 @@ +SHELL:=/bin/bash + +LTO_PARAM:= +ifeq ($(USE_LTO),1) +LTO_PARAM:=-flto +endif + +FULL_LIBRARY:=lib$(LIBRARY).so +define NEW_LINE + + +endef + +export NEW_LINE + +CXX_FLAGS := -Wall -pedantic -Wextra -Werror -Wshadow -Wpointer-arith -Wcast-qual -Wdelete-non-virtual-dtor -Wredundant-decls + +space := $(eval) $(eval) + +LDFLAGS_DEBUG:=-rdynamic -shared +TEST_LDFLAGS_DEBUG:=-Wl,--no-as-needed -Llib-debug $(addprefix -L, $(addsuffix lib-debug, $(LINK_PATHS))) -rdynamic -l$(LIBRARY) $(addprefix -l, $(LINK_LIBRARIES)) -lcppunit -Wl,-rpath,. + +LDFLAGS_RELEASE:=-rdynamic -shared $(LTO_PARAM) +TEST_LDFLAGS_RELEASE:=-Wl,--no-as-needed -Llib-release $(addprefix -L, $(addsuffix lib-release, $(LINK_PATHS))) -rdynamic -l$(LIBRARY) $(addprefix -l, $(LINK_LIBRARIES)) -lcppunit $(LTO_PARAM) -Wl,-rpath,. + +OBJECTS_DEBUG:=$(patsubst src/%.cpp,obj-debug/%.o, $(shell find src/ -name *cpp)) +TEST_OBJECTS_DEBUG:=$(patsubst test-src/%.cpp,test-obj-debug/%.o, $(shell find test-src/ -name *cpp)) + +OBJECTS_RELEASE:=$(patsubst src/%.cpp,obj-release/%.o, $(filter-out $(wildcard src/debug/*), $(shell find src/ -name *cpp))) +TEST_OBJECTS_RELEASE:=$(patsubst test-src/%.cpp,test-obj-release/%.o, $(shell find test-src/ -name *cpp)) + +.PHONY: all debug release clean build-debug build-release clean-debug clean-release doc + +all: + @echo "What to do master?" + +FORCE: + +# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +# make subdir makefile + +%/makefile: ../makefile-library ../build.conf makefile makefile.conf + if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ + ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ + fi;\ + if [ -L $(subst /,, $(dir $@)) ]; then\ + mkdir -p `readlink $(subst /,, $(dir $@))`;\ + else\ + mkdir -p $(dir $@);\ + fi + echo "\ + SHELL:=/bin/bash$${NEW_LINE}\ + SRCDIR:=$${NEW_LINE}\ + $${NEW_LINE}\ + define NEW_LINE$${NEW_LINE}\ + $${NEW_LINE}\ + $${NEW_LINE}\ + endef$${NEW_LINE}\ + $${NEW_LINE}\ + export NEW_LINE$${NEW_LINE}\ + $${NEW_LINE}\ + CXXFLAGS:= -pipe -std=c++11 \$$(CXX_OTHER_FLAGS) -c $(CXX_FLAGS) -fPIC \$$(addprefix -I, \$$(realpath $(INCLUDE_PATHS))) -I\$$(realpath \$$(SOURCES_BASE_DIR)/../src/)$${NEW_LINE}\ + $${NEW_LINE}\ + SOURCES:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -type f -name \"*.cpp\")$${NEW_LINE}\ + DEPENDENCIES:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d, \$$(SOURCES))$${NEW_LINE}\ + OBJECTS:= \$$(patsubst %.d, %.o, \$$(DEPENDENCIES))$${NEW_LINE}\ + SOURCES_DIRS:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -mindepth 1 -type d)$${NEW_LINE}\ + OBJECTS_DIRS:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%, %/, \$$(SOURCES_DIRS))$${NEW_LINE}\ + OBJECTS_DIRS_MAKEFILES:= \$$(patsubst %, %makefile, \$$(OBJECTS_DIRS))$${NEW_LINE}\ + $${NEW_LINE}\ + .PHONY: all$${NEW_LINE}\ + .PRECIOUS: \$$(DEPENDECIES) \$$(OBJECTS_DIRS_MAKEFILES)$${NEW_LINE}\ + $${NEW_LINE}\ + all: \$$(OBJECTS_DIRS) \$$(OBJECTS)$${NEW_LINE}\ + $${NEW_LINE}\ + %.d: makefile$${NEW_LINE}\ + @echo \"\\$${NEW_LINE}\ + \$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\") = \\$$\$$(shell (\\$$\$$(CXX) -M \\$$\$$(CXXFLAGS) \$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) 2>/dev/null || echo \\\"\$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) FORCE\\\") | sed \\\"s/.*://g;s/\\\\\\\\\\\\\\\\//g\\\")\$$\$${NEW_LINE}\\$${NEW_LINE}\ + \$$(patsubst %.d,%.o, \$$@): \\$$\$$(\$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\")) makefile\$$\$${NEW_LINE}\\$${NEW_LINE}\ + \\$$\$$(CXX) \\$$\$$(CXXFLAGS) \\$$\$$< -o \$$(patsubst %.d,%.o, \$$@)\$$\$${NEW_LINE}\\$${NEW_LINE}\ + \" > \$$@$${NEW_LINE}\ + $${NEW_LINE}\ + %/makefile: makefile$${NEW_LINE}\ + mkdir -p \$$(dir \$$@)$${NEW_LINE}\ + cp makefile \$$@$${NEW_LINE}\ + $${NEW_LINE}\ + %/: FORCE | %/makefile$${NEW_LINE}\ + @accesstime=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ + \$$(MAKE) -C \$$@ SRCDIR=\$$(SRCDIR)\$$(notdir \$$(patsubst %/, %, \$$@))/ OBJECTS_BASE_DIR=\$$(OBJECTS_BASE_DIR) SOURCES_BASE_DIR=\$$(SOURCES_BASE_DIR) CXX_OTHER_FLAGS=\"\$$(CXX_OTHER_FLAGS)\" && \\$${NEW_LINE}\ + accesstime2=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ + if [ "\$$\$$accesstime" -ne "\$$\$$accesstime2" ]; then \\$${NEW_LINE}\ + touch .; \\$${NEW_LINE}\ + fi$${NEW_LINE}\ + $${NEW_LINE}\ + FORCE:$${NEW_LINE}\ + $${NEW_LINE}\ + -include \$$(DEPENDENCIES)" > $@ + +# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +# final lib/bin construction + +lib-debug/$(FULL_LIBRARY): $(OBJECTS_DEBUG) obj-debug/ + if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ + ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ + fi;\ + if [ -L $(subst /,, $(dir $@)) ]; then\ + mkdir -p `readlink $(subst /,, $(dir $@))`;\ + else\ + mkdir -p $(dir $@);\ + fi + $(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG) + +lib-release/$(FULL_LIBRARY): $(OBJECTS_RELEASE) obj-release/ + if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ + ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ + fi;\ + if [ -L $(subst /,, $(dir $@)) ]; then\ + mkdir -p `readlink $(subst /,, $(dir $@))`;\ + else\ + mkdir -p $(dir $@);\ + fi + $(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE) + +test-bin-debug/$(TESTBIN): $(TEST_OBJECTS_DEBUG) test-obj-debug/ + if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ + ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ + fi;\ + if [ -L $(subst /,, $(dir $@)) ]; then\ + mkdir -p `readlink $(subst /,, $(dir $@))`;\ + else\ + mkdir -p $(dir $@);\ + fi + $(CXX) $(TEST_OBJECTS_DEBUG) -o $@ $(TEST_LDFLAGS_DEBUG) + +test-bin-release/$(TESTBIN): $(TEST_OBJECTS_RELEASE) test-obj-release/ + if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ + ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ + fi;\ + if [ -L $(subst /,, $(dir $@)) ]; then\ + mkdir -p `readlink $(subst /,, $(dir $@))`;\ + else\ + mkdir -p $(dir $@);\ + fi + $(CXX) $(TEST_OBJECTS_RELEASE) -o $@ $(TEST_LDFLAGS_RELEASE) + +# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +# subdir make calls + +obj-debug/: FORCE obj-debug/makefile + $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-debug) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-g -Og -DDEBUG" + +obj-release/: FORCE obj-release/makefile + $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-release) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-O3 -DNDEBUG -DRELEASE $(LTO_PARAM)" + +test-obj-debug/: FORCE test-obj-debug/makefile + $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath test-obj-debug) SOURCES_BASE_DIR=$(realpath test-src) CXX_OTHER_FLAGS="-g -Og -DDEBUG" + +test-obj-release/: FORCE test-obj-release/makefile + $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath test-obj-release) SOURCES_BASE_DIR=$(realpath test-src) CXX_OTHER_FLAGS="-O3 -DNDEBUG -DRELEASE $(LTO_PARAM)" + +# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +# objects dependencies + +$(OBJECTS_DEBUG): obj-debug/ + +$(OBJECTS_RELEASE): obj-release/ + +$(TEST_OBJECTS_DEBUG): test-obj-debug/ + +$(TEST_OBJECTS_RELEASE): test-obj-release/ + +# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +# standalone main targets + +test-unit-debug: + LD_LIBRARY_PATH="$(subst $(space),,$(addsuffix lib-debug:,$(LINK_PATHS)))lib-debug" test-bin-debug/$(TESTBIN) + +test-unit-release: + LD_LIBRARY_PATH="$(subst $(space),,$(addsuffix lib-release:,$(LINK_PATHS)))lib-release" test-bin-release/$(TESTBIN) + +build-test-debug: test-bin-debug/$(TESTBIN) + +build-test-release: test-bin-release/$(TESTBIN) + +build-code-debug: lib-debug/$(FULL_LIBRARY) + +build-code-release: lib-release/$(FULL_LIBRARY) + +# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +# do all main targets + +debug: + $(MAKE) build-code-debug + $(MAKE) build-test-debug + $(MAKE) test-unit-debug + +release: + $(MAKE) build-code-release + $(MAKE) build-test-release + $(MAKE) test-unit-release + +clean: clean-debug clean-release + $(RM) -r doc + +clean-debug: + if [ -L obj-debug ]; then\ + $(RM) -r `readlink obj-debug`;\ + fi + if [ -L lib-debug ]; then\ + $(RM) -r `readlink lib-debug`;\ + fi + if [ -L test-obj-debug ]; then\ + $(RM) -r `readlink test-obj-debug`;\ + fi + if [ -L test-bin-debug ]; then\ + $(RM) -r `readlink test-bin-debug`;\ + fi + $(RM) -r *.o *.d lib-debug obj-debug test-bin-debug test-obj-debug CppUnitTestResults.xml + +clean-release: + if [ -L obj-release ]; then\ + $(RM) -r `readlink obj-release`;\ + fi + if [ -L lib-release ]; then\ + $(RM) -r `readlink lib-release`;\ + fi + if [ -L test-obj-release ]; then\ + $(RM) -r `readlink test-obj-release`;\ + fi + if [ -L test-bin-release ]; then\ + $(RM) -r `readlink test-bin-release`;\ + fi + $(RM) -r *.o *.d lib-release obj-release test-bin-release test-obj-release CppUnitTestResults.xml + +doc: + doxygen diff --git a/tniceprint/makefile b/tniceprint/makefile index 4064fd0131..bd9fb6f7bc 100644 --- a/tniceprint/makefile +++ b/tniceprint/makefile @@ -1,174 +1,3 @@ -SHELL:=/bin/bash - --include ../build.conf -include makefile.conf - -LTO_PARAM:= -ifeq ($(USE_LTO),1) -LTO_PARAM:= -flto -endif - -define NEW_LINE - - -endef - -export NEW_LINE - -CXX_FLAGS := -Wall -pedantic -Wextra -Werror -Wshadow -Wpointer-arith -Wcast-qual -Wdelete-non-virtual-dtor -Wredundant-decls - -LDFLAGS_DEBUG:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-debug, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) -Wl,-rpath,. - -LDFLAGS_RELEASE:=-Wl,--no-as-needed $(addprefix -L, $(addsuffix lib-release, $(LINK_PATHS))) -rdynamic $(addprefix -l, $(LINK_LIBRARIES)) $(LTO_PARAM) -Wl,-rpath,. - -OBJECTS_DEBUG:=$(patsubst src/%.cpp,obj-debug/%.o, $(shell find src/ -name *cpp)) - -OBJECTS_RELEASE:=$(patsubst src/%.cpp,obj-release/%.o, $(shell find src/ -name *cpp)) - -.PHONY: all build-debug clean-debug doc - -all: - @echo "What to do master?" - -FORCE: - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# make subdir makefile - -%/makefile: makefile makefile.conf - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - echo "\ - SHELL:=/bin/bash$${NEW_LINE}\ - SRCDIR:=$${NEW_LINE}\ - $${NEW_LINE}\ - define NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - $${NEW_LINE}\ - endef$${NEW_LINE}\ - $${NEW_LINE}\ - export NEW_LINE$${NEW_LINE}\ - $${NEW_LINE}\ - CXXFLAGS:= -pipe -std=c++11 \$$(CXX_OTHER_FLAGS) -c $(CXX_FLAGS) -fPIC \$$(addprefix -I, \$$(realpath $(INCLUDE_PATHS)))$${NEW_LINE}\ - $${NEW_LINE}\ - SOURCES:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -type f -name \"*.cpp\")$${NEW_LINE}\ - DEPENDENCIES:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d, \$$(SOURCES))$${NEW_LINE}\ - OBJECTS:= \$$(patsubst %.d, %.o, \$$(DEPENDENCIES))$${NEW_LINE}\ - SOURCES_DIRS:= \$$(shell find \$$(SOURCES_BASE_DIR)/\$$(SRCDIR) -maxdepth 1 -mindepth 1 -type d)$${NEW_LINE}\ - OBJECTS_DIRS:= \$$(patsubst \$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%, %/, \$$(SOURCES_DIRS))$${NEW_LINE}\ - OBJECTS_DIRS_MAKEFILES:= \$$(patsubst %, %makefile, \$$(OBJECTS_DIRS))$${NEW_LINE}\ - $${NEW_LINE}\ - .PHONY: all$${NEW_LINE}\ - .PRECIOUS: \$$(DEPENDECIES) \$$(OBJECTS_DIRS_MAKEFILES)$${NEW_LINE}\ - $${NEW_LINE}\ - all: \$$(OBJECTS_DIRS) \$$(OBJECTS)$${NEW_LINE}\ - $${NEW_LINE}\ - %.d: makefile$${NEW_LINE}\ - @echo \"\\$${NEW_LINE}\ - \$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\") = \\$$\$$(shell (\\$$\$$(CXX) -M \\$$\$$(CXXFLAGS) \$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) 2>/dev/null || echo \\\"\$$(patsubst \$$(OBJECTS_BASE_DIR)/\$$(SRCDIR)%.d,\$$(SOURCES_BASE_DIR)/\$$(SRCDIR)%.cpp, \$$@) FORCE\\\") | sed \\\"s/.*://g;s/\\\\\\\\\\\\\\\\//g\\\")\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \$$(patsubst %.d,%.o, \$$@): \\$$\$$(\$$(shell sha1sum <<< \"\$$@\" | sed \"s/ -//g\")) makefile\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \\$$\$$(CXX) \\$$\$$(CXXFLAGS) \\$$\$$< -o \$$(patsubst %.d,%.o, \$$@)\$$\$${NEW_LINE}\\$${NEW_LINE}\ - \" > \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/makefile: makefile$${NEW_LINE}\ - mkdir -p \$$(dir \$$@)$${NEW_LINE}\ - cp makefile \$$@$${NEW_LINE}\ - $${NEW_LINE}\ - %/: FORCE | %/makefile$${NEW_LINE}\ - @accesstime=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - \$$(MAKE) -C \$$@ SRCDIR=\$$(SRCDIR)\$$(notdir \$$(patsubst %/, %, \$$@))/ OBJECTS_BASE_DIR=\$$(OBJECTS_BASE_DIR) SOURCES_BASE_DIR=\$$(SOURCES_BASE_DIR) CXX_OTHER_FLAGS=\"\$$(CXX_OTHER_FLAGS)\" && \\$${NEW_LINE}\ - accesstime2=\`stat -c %Y \$$@\` && \\$${NEW_LINE}\ - if [ "\$$\$$accesstime" -ne "\$$\$$accesstime2" ]; then \\$${NEW_LINE}\ - touch .; \\$${NEW_LINE}\ - fi$${NEW_LINE}\ - $${NEW_LINE}\ - FORCE:$${NEW_LINE}\ - $${NEW_LINE}\ - -include \$$(DEPENDENCIES)" > $@ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# final lib/bin construction - -bin-debug/$(EXECUTABLE): obj-debug/ $(OBJECTS_DEBUG) - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG) - -bin-release/$(EXECUTABLE): obj-release/ $(OBJECTS_RELEASE) - if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\ - ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /,, $(dir $@)) 2>/dev/null;\ - fi;\ - if [ -L $(subst /,, $(dir $@)) ]; then\ - mkdir -p `readlink $(subst /,, $(dir $@))`;\ - else\ - mkdir -p $(dir $@);\ - fi - $(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# subdir make calls - -obj-debug/: FORCE | obj-debug/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-debug) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-g -Og -DDEBUG" - -obj-release/: FORCE | obj-release/makefile - $(MAKE) -C $@ OBJECTS_BASE_DIR=$(realpath obj-release) SOURCES_BASE_DIR=$(realpath src) CXX_OTHER_FLAGS="-O3 -DNDEBUG -DRELEASE $(LTO_PARAM)" - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# objects dependencies - -$(OBJECTS_DEBUG): obj-debug/ - -$(OBJECTS_RELEASE): obj-release/ - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# standalone main targets - -build-code-debug: bin-debug/$(EXECUTABLE) - -build-code-release: bin-release/$(EXECUTABLE) - -# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -# do all main targets - -debug: - $(MAKE) build-code-debug - -release: - $(MAKE) build-code-release - -clean: clean-debug clean-release - $(RM) -r doc - -clean-debug: - if [ -L obj-debug ]; then\ - $(RM) -r `readlink obj-debug`;\ - fi - if [ -L bin-debug ]; then\ - $(RM) -r `readlink bin-debug`;\ - fi - $(RM) -r *.o *.d bin-debug obj-debug - -clean-release: - if [ -L obj-release ]; then\ - $(RM) -r `readlink obj-release`;\ - fi - if [ -L lib-release ]; then\ - $(RM) -r `readlink lib-release`;\ - fi - $(RM) -r *.o *.d bin-release obj-release - -doc: - doxygen +-include ../build.conf +-include ../makefile-binary -- GitLab