Skip to content

Commit

Permalink
fixed linker and build dir errors
Browse files Browse the repository at this point in the history
  • Loading branch information
lzichi committed Oct 9, 2024
1 parent 8d83126 commit 43ee733
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 15 deletions.
14 changes: 9 additions & 5 deletions GMC/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
14 changes: 9 additions & 5 deletions LGMC/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
14 changes: 9 additions & 5 deletions NPMC/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 43ee733

Please sign in to comment.