Skip to content
Snippets Groups Projects
Commit 56e3510e authored by Jan Trávníček's avatar Jan Trávníček
Browse files

detect deleted source files and recompile binaries

parent d474ac49
No related branches found
No related tags found
No related merge requests found
......@@ -29,9 +29,38 @@ RELEASE_LINK_PATHS:=$(addsuffix /lib-release, $(addprefix ../, $(LINK_LIBRARIES)
 
LDFLAGS_RELEASE:=-Wl,--no-as-needed $(addprefix -L, $(RELEASE_LINK_PATHS)) -rdynamic $(addprefix -l, $(LINK_LIBRARIES) $(SYSTEM_LIBRARIES)) $(LTO_PARAM) -Wl,-rpath,.
 
OBJECTS_DEBUG:=$(patsubst src/%.cpp,obj-debug/%.o, $(shell find src/ -name *cpp))
OBJECTS_DEBUG:=$(patsubst src/%.cpp,obj-debug/%.o, $(sort $(shell find src/ -name *cpp)))
 
OBJECTS_RELEASE:=$(patsubst src/%.cpp,obj-release/%.o, $(shell find src/ -name *cpp))
OBJECTS_RELEASE:=$(patsubst src/%.cpp,obj-release/%.o, $(sort $(shell find src/ -name *cpp)))
# ---------------------------------------------------------------------------------------------------------------------------------------------------------
# to handle deleted source files
EXISTENT_OBJECTS_DEBUG:=$(sort $(shell find obj-debug/ -name *o))
EXISTENT_OBJECTS_RELEASE:=$(sort $(shell find obj-release/ -name *o))
EXTRA_OBJECTS_DEBUG:=$(filter-out $(OBJECTS_DEBUG), $(EXISTENT_OBJECTS_DEBUG))
EXTRA_OBJECTS_RELEASE:=$(filter-out $(OBJECTS_RELEASE), $(EXISTENT_OBJECTS_RELEASE))
ifneq ($(strip $(EXTRA_OBJECTS_DEBUG)),)
ifneq ($(wildcard lib-debug/$(FULL_LIBRARY)),)
ifneq ($(firstword $(EXISTENT_OBJECTS_DEBUG)),)
$(shell touch $(firstword $(EXISTENT_OBJECTS_DEBUG)))
endif
endif
endif
ifneq ($(strip $(EXTRA_OBJECTS_RELEASE)),)
ifneq ($(wildcard lib-release/$(FULL_LIBRARY)),)
ifneq ($(firstword $(EXISTENT_OBJECTS_RELEASE)),)
$(shell touch $(firstword $(EXISTENT_OBJECTS_RELEASE)))
endif
endif
endif
# ---------------------------------------------------------------------------------------------------------------------------------------------------------
 
.PHONY: all build-debug clean-debug doc
 
......
......@@ -44,11 +44,60 @@ LDFLAGS_RELEASE:=-rdynamic -shared $(LTO_PARAM) $(addprefix -L, $(RELEASE_LINK_P
TEST_LDFLAGS_RELEASE:=-Wl,--no-as-needed $(addprefix -L, $(RELEASE_TEST_LINK_PATHS)) -rdynamic $(addprefix -l, $(TEST_LINK_LIBRARIES) $(TEST_SYSTEM_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_DEBUG:=$(patsubst src/%.cpp,obj-debug/%.o, $(sort $(shell find src/ -name *cpp)))
TEST_OBJECTS_DEBUG:=$(patsubst test-src/%.cpp,test-obj-debug/%.o, $(sort $(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))
OBJECTS_RELEASE:=$(patsubst src/%.cpp,obj-release/%.o, $(filter-out $(wildcard src/debug/*), $(sort $(shell find src/ -name *cpp))))
TEST_OBJECTS_RELEASE:=$(patsubst test-src/%.cpp,test-obj-release/%.o, $(sort $(shell find test-src/ -name *cpp)))
# ---------------------------------------------------------------------------------------------------------------------------------------------------------
# to handle deleted source files
EXISTENT_OBJECTS_DEBUG:=$(sort $(shell find obj-debug/ -name *o))
EXISTENT_TEST_OBJECTS_DEBUG:=$(sort $(shell find test-obj-debug/ -name *o))
EXISTENT_OBJECTS_RELEASE:=$(sort $(shell find obj-release/ -name *o))
EXISTENT_TEST_OBJECTS_RELEASE:=$(sort $(shell find test-obj-release/ -name *o))
EXTRA_OBJECTS_DEBUG:=$(filter-out $(OBJECTS_DEBUG), $(EXISTENT_OBJECTS_DEBUG))
EXTRA_TEST_OBJECTS_DEBUG:=$(filter-out $(TEST_OBJECTS_DEBUG), $(EXISTENT_TEST_OBJECTS_DEBUG))
EXTRA_OBJECTS_RELEASE:=$(filter-out $(OBJECTS_RELEASE), $(EXISTENT_OBJECTS_RELEASE))
EXTRA_TEST_OBJECTS_RELEASE:=$(filter-out $(TEST_OBJECTS_RELEASE), $(EXISTENT_TEST_OBJECTS_RELEASE))
ifneq ($(strip $(EXTRA_OBJECTS_DEBUG)),)
ifneq ($(wildcard lib-debug/$(FULL_LIBRARY)),)
ifneq ($(firstword $(EXISTENT_OBJECTS_DEBUG)),)
$(shell touch $(firstword $(EXISTENT_OBJECTS_DEBUG)))
endif
endif
endif
ifneq ($(strip $(EXTRA_TEST_OBJECTS_DEBUG)),)
ifneq ($(wildcard test-bin-debug/$(TESTBIN)),)
ifneq ($(firstword $(EXISTENT_TEST_OBJECTS_DEBUG)),)
$(shell touch $(firstword $(EXISTENT_TEST_OBJECTS_DEBUG)))
endif
endif
endif
ifneq ($(strip $(EXTRA_OBJECTS_RELEASE)),)
ifneq ($(wildcard lib-release/$(FULL_LIBRARY)),)
ifneq ($(firstword $(EXISTENT_OBJECTS_RELEASE)),)
$(shell touch $(firstword $(EXISTENT_OBJECTS_RELEASE)))
endif
endif
endif
ifneq ($(strip $(EXTRA_TEST_OBJECTS_RELEASE)),)
ifneq ($(wildcard test-bin-release/$(TESTBIN)),)
ifneq ($(firstword $(EXISTENT_TEST_OBJECTS_RELEASE)),)
$(shell touch $(firstword $(EXISTENT_TEST_OBJECTS_RELEASE)))
endif
endif
endif
# ---------------------------------------------------------------------------------------------------------------------------------------------------------
 
.PHONY: all debug release clean build-debug build-release clean-debug clean-release doc
 
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment