Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22145

[MAKEFILE]: How to copy cpp source files from different source folders into one destination folder and use those cpp files to build using MAKE

$
0
0

My Current makefile looks like the following, and it build the targets correctly. But it fails to build the targets in one instance, that is when the length of the path to source files becomes too long. Therefore I want to collect all my source files in different folders into one single source directory and then do the make.

Any leads on how I can modify the following makefile to create a flat source directory and use the files in that directory to build using make

PROJ_DIR := ../SRC_DIR += $(PROJ_DIR)projectSRC_FILES += $(wildcard $(SRC_DIR)/*/source/*.cpp)OBJ_DIR := $(PROJ_DIR)TASKOBJ_FILES += $(patsubst $(SRC_DIR)/%.cpp,$(OBJ_DIR)/%.o,$(SRC_FILES))CXXFLAGS := --c++14CC_INCLUDE_PATH += -I$(PROJ_DIR)project/include.PHONY: all clean dirsall: $(OBJ_DIR) $(OBJ_FILES) "$(COMPILERBIN)"/cc.exe -rvn crackLib.a $(OBJ_FILES)clean:    @rm -rf crackLib.a $(OBJ_DIR) $(FLAT_INC_DIR)  # Build target for directory creation. Intermediate build files will be placed here.$(OBJ_DIR):    mkdir -p $@$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp "$(COMPILERBIN)"/cc.exe $(CXXFLAGS) -c -o $@ $< $(CC_INCLUDE_PATH) $(OBJ_DIR)/%.o: $(TSM_SRC_DIR)/%.cpp"$(COMPILERBIN)"/cc.exe $(CXXFLAGS) -c -o $@ $< $(CC_INCLUDE_PATH) $(OBJ_DIR)/%.o: $(SL_SRC_DIR)/%.cpp"$(COMPILERBIN)"/cc.exe $(CXXFLAGS) -c -o $@ $< $(CC_INCLUDE_PATH) -include $(OBJ_FILES:.o=.d)

Viewing all articles
Browse latest Browse all 22145

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>