From 43ee733f9a27562ee1592b52f6d00bf3aae4c6a0 Mon Sep 17 00:00:00 2001 From: lzichi Date: Tue, 8 Oct 2024 22:38:36 -0400 Subject: [PATCH] fixed linker and build dir errors --- GMC/makefile | 14 +++++++++----- LGMC/makefile | 14 +++++++++----- NPMC/makefile | 14 +++++++++----- 3 files changed, 27 insertions(+), 15 deletions(-) diff --git a/GMC/makefile b/GMC/makefile index 8969034..da46992 100644 --- a/GMC/makefile +++ b/GMC/makefile @@ -27,26 +27,30 @@ CXXFLAGS = -fno-rtti -fno-exceptions -std=c++17 -Wall -Wextra -lsqlite3 -lpthrea # also defines DEBUG, so "#ifdef DEBUG /*...*/ #endif" works debug: CXXFLAGS += -g3 -DDEBUG debug: - $(CXX) $(CXXFLAGS) $(SOURCES) -o $(BUILD_DIR)$(EXECUTABLE)_debug + @mkdir -p $(BUILD_DIR) + $(CXX) $(SOURCES) -o $(BUILD_DIR)/$(EXECUTABLE)_debug $(CXXFLAGS) # make profile - will compile "all" with $(CXXFLAGS) and the -g3 and -O3 flags profile: CXXFLAGS += -g3 -O3 profile: - $(CXX) $(CXXFLAGS) $(SOURCES) -o $(BUILD_DIR)/$(EXECUTABLE)_profile + @mkdir -p $(BUILD_DIR) + $(CXX) $(SOURCES) -o $(BUILD_DIR)/$(EXECUTABLE)_profile $(CXXFLAGS) # make gprof - will compile "all" with $(CXXFLAGS) and the -pg (for gprof) gprof: CXXFLAGS += -pg gprof: - $(CXX) $(CXXFLAGS) $(SOURCES) -o $(BUILD_DIR)/$(EXECUTABLE)_profile + @mkdir -p $(BUILD_DIR) + $(CXX) $(SOURCES) -o $(BUILD_DIR)/$(EXECUTABLE)_profile $(CXXFLAGS) # Build all executables all: debug profile gprof $(EXECUTABLE): - $(CXX) $(CXXFLAGS) $(SOURCES) -o $(BUILD_DIR)/$(EXECUTABLE) + @mkdir -p $(BUILD_DIR) + $(CXX) $(SOURCES) -o $(BUILD_DIR)/$(EXECUTABLE) $(CXXFLAGS) # rule for creating objects %.o: %.cpp - $(CXX) $(CXXFLAGS) -c $< -o $(BUILD_DIR)/$(dir $@)$(notdir $@) + $(CXX) -c $< -o $(BUILD_DIR)/$(dir $@)$(notdir $@) $(CXXFLAGS) # make clean - remove .o files, executables, tarball clean: diff --git a/LGMC/makefile b/LGMC/makefile index fa24b6b..e3e12fd 100644 --- a/LGMC/makefile +++ b/LGMC/makefile @@ -25,27 +25,31 @@ CXXFLAGS = -fno-rtti -fno-exceptions -std=c++17 -Wall -Wextra $(shell gsl-config # also defines DEBUG, so "#ifdef DEBUG /*...*/ #endif" works debug: CXXFLAGS += -g3 -DDEBUG debug: - $(CXX) $(CXXFLAGS) $(SOURCES) -o $(BUILD_DIR)/$(EXECUTABLE)_debug + @mkdir -p $(BUILD_DIR) + $(CXX) $(SOURCES) -o $(BUILD_DIR)/$(EXECUTABLE)_debug $(CXXFLAGS) # make profile - will compile "all" with $(CXXFLAGS) and the -g3 and -O3 flags profile: CXXFLAGS += -g3 -O3 profile: - $(CXX) $(CXXFLAGS) $(SOURCES) -o $(BUILD_DIR)/$(EXECUTABLE)_profile + @mkdir -p $(BUILD_DIR) + $(CXX) $(SOURCES) -o $(BUILD_DIR)/$(EXECUTABLE)_profile $(CXXFLAGS) # make gprof - will compile "all" with $(CXXFLAGS) and the -pg (for gprof) gprof: CXXFLAGS += -pg gprof: - $(CXX) $(CXXFLAGS) $(SOURCES) -o $(BUILD_DIR)/$(EXECUTABLE)_profile + @mkdir -p $(BUILD_DIR) + $(CXX) $(SOURCES) -o $(BUILD_DIR)/$(EXECUTABLE)_profile $(CXXFLAGS) # Build all executables all: debug profile gprof $(EXECUTABLE): - $(CXX) $(CXXFLAGS) $(SOURCES) -o $(BUILD_DIR)/$(EXECUTABLE) + @mkdir -p $(BUILD_DIR) + $(CXX) $(SOURCES) -o $(BUILD_DIR)/$(EXECUTABLE) $(CXXFLAGS) # rule for creating objects %.o: %.cpp - $(CXX) $(CXXFLAGS) -c $< -o $(BUILD_DIR)/$(dir $@)$(notdir $@) + $(CXX) -c $< -o $(BUILD_DIR)/$(dir $@)$(notdir $@) $(CXXFLAGS) # make clean - remove .o files, executables, tarball clean: diff --git a/NPMC/makefile b/NPMC/makefile index 04b4df9..c2f8788 100644 --- a/NPMC/makefile +++ b/NPMC/makefile @@ -26,26 +26,30 @@ CXXFLAGS = -fno-rtti -fno-exceptions -std=c++17 -Wall -Wextra $(shell gsl-config # also defines DEBUG, so "#ifdef DEBUG /*...*/ #endif" works debug: CXXFLAGS += -g3 -DDEBUG debug: - $(CXX) $(CXXFLAGS) $(SOURCES) -o $(BUILD_DIR)/$(EXECUTABLE)_debug + @mkdir -p $(BUILD_DIR) + $(CXX) $(SOURCES) -o $(BUILD_DIR)/$(EXECUTABLE)_debug $(CXXFLAGS) # make profile - will compile "all" with $(CXXFLAGS) and the -g3 and -O3 flags profile: CXXFLAGS += -g3 -O3 profile: - $(CXX) $(CXXFLAGS) $(SOURCES) -o $(BUILD_DIR)/$(EXECUTABLE)_profile + @mkdir -p $(BUILD_DIR) + $(CXX) $(SOURCES) -o $(BUILD_DIR)/$(EXECUTABLE)_profile $(CXXFLAGS) # make gprof - will compile "all" with $(CXXFLAGS) and the -pg (for gprof) gprof: CXXFLAGS += -pg gprof: - $(CXX) $(CXXFLAGS) $(SOURCES) -o $(BUILD_DIR)/$(EXECUTABLE)_profile + @mkdir -p $(BUILD_DIR) + $(CXX) $(SOURCES) -o $(BUILD_DIR)/$(EXECUTABLE)_profile $(CXXFLAGS) # Build all executables all: debug profile gprof $(EXECUTABLE): - $(CXX) $(CXXFLAGS) $(SOURCES) -o $(BUILD_DIR)/$(EXECUTABLE) + @mkdir -p $(BUILD_DIR) + $(CXX) $(SOURCES) -o $(BUILD_DIR)/$(EXECUTABLE) $(CXXFLAGS) # rule for creating objects %.o: %.cpp - $(CXX) $(CXXFLAGS) -c $< -o $(BUILD_DIR)/$(dir $@)$(notdir $@) + $(CXX) -c $< -o $(BUILD_DIR)/$(dir $@)$(notdir $@) $(CXXFLAGS) # make clean - remove .o files, executables, tarball clean: