This is my current Makefile that only searches the top level directory in the src folder.
I want it to automatically search all subdirs in the src folder and link to one single exe.
Code:APP_NAME = CoDstructor SRC_DIR = src/cod OBJ_DIR = obj BIN_DIR = bin INC_DIR = -Isrc CXXFLAGS += -g CXXFLAGS += -Wall CXXFLAGS += -Werror CXXFLAGS += -Wextra CXXFLAGS += -pedantic CXXFLAGS += -std=c++11 CXXFLAGS += $(INC_DIR) LDFLAGS += -g LDFLAGS += -static LDFLAGS += -static-libstdc++ LDFLAGS += -static-libgcc SOURCES = $(wildcard $(SRC_DIR)/*.cpp) OBJS = $(addprefix $(OBJ_DIR)/,$(notdir $(SOURCES:.cpp=.o))) $(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp $(CXX) $(CXXFLAGS) -c $< -o $@ $(BIN_DIR)/$(APP_NAME): $(OBJS) $(CXX) $(LDFLAGS) $(OBJS) -o $@



Reply With Quote