Tidied up Makefile; fixed compile commands not generating
parent
584bcb94d1
commit
7c43bcb2d8
29
Makefile
29
Makefile
|
@ -10,39 +10,50 @@ all: debug
|
||||||
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@ rm -rf $(BUILD_DIR)
|
@ [ ! -e '$(BINARY)' ] || rm '$(BINARY)'
|
||||||
|
@ rm -rf '$(BUILD_DIR)'
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
|
|
||||||
|
|
||||||
# Release
|
# Release
|
||||||
run-release: release
|
run-release: release
|
||||||
@ ./$(RELEASE_DIR)/$(BINARY)
|
@ ./'$(RELEASE_DIR)/$(BINARY)'
|
||||||
.PHONY: run-release
|
.PHONY: run-release
|
||||||
|
|
||||||
release: $(RELEASE_DIR)/Makefile
|
release: $(RELEASE_DIR)/Makefile
|
||||||
@ make -C $(RELEASE_DIR) -j$(CORES)
|
@ make -C '$(RELEASE_DIR)' -j'$(CORES)' && \
|
||||||
|
ln -sf '$(RELEASE_DIR)'/'$(BINARY)' ./'$(BINARY)'
|
||||||
.PHONY: release
|
.PHONY: release
|
||||||
|
|
||||||
$(RELEASE_DIR)/Makefile: $(SRC_DIR)/CMakeLists.txt
|
$(RELEASE_DIR)/Makefile: $(SRC_DIR)/CMakeLists.txt
|
||||||
@ cmake -H$(SRC_DIR) -B$(RELEASE_DIR) -DCMAKE_BUILD_TYPE=Release
|
@ cmake \
|
||||||
|
-H'$(SRC_DIR)' \
|
||||||
|
-B'$(RELEASE_DIR)' \
|
||||||
|
-DCMAKE_BUILD_TYPE=Release \
|
||||||
|
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
|
||||||
|
|
||||||
clean-release:
|
clean-release:
|
||||||
@ rm -rf $(RELEASE_DIR)
|
@ rm -rf '$(RELEASE_DIR)'
|
||||||
.PHONY: clean-release
|
.PHONY: clean-release
|
||||||
|
|
||||||
|
|
||||||
# Debug
|
# Debug
|
||||||
run-debug: debug
|
run-debug: debug
|
||||||
@ ./$(DEBUG_DIR)/$(BINARY)
|
@ ./'$(DEBUG_DIR)/$(BINARY)'
|
||||||
.PHONY: run-debug
|
.PHONY: run-debug
|
||||||
|
|
||||||
debug: $(DEBUG_DIR)/Makefile
|
debug: $(DEBUG_DIR)/Makefile
|
||||||
@ make -C $(DEBUG_DIR) -j$(CORES)
|
@ make -C '$(DEBUG_DIR)' -j'$(CORES)' && \
|
||||||
|
ln -sf '$(DEBUG_DIR)/$(BINARY)' ./'$(BINARY)'
|
||||||
.PHONY: debug
|
.PHONY: debug
|
||||||
|
|
||||||
$(DEBUG_DIR)/Makefile: $(SRC_DIR)/CMakeLists.txt
|
$(DEBUG_DIR)/Makefile: $(SRC_DIR)/CMakeLists.txt
|
||||||
@ cmake -H$(SRC_DIR) -B$(DEBUG_DIR) -DCMAKE_BUILD_TYPE=Debug
|
@ cmake \
|
||||||
|
-H'$(SRC_DIR)' \
|
||||||
|
-B'$(DEBUG_DIR)' \
|
||||||
|
-DCMAKE_BUILD_TYPE=Debug \
|
||||||
|
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
|
||||||
|
|
||||||
clean-debug:
|
clean-debug:
|
||||||
@ rm -rf $(DEBUG_DIR)
|
@ rm -rf '$(DEBUG_DIR)'
|
||||||
.PHONY: clean-debug
|
.PHONY: clean-debug
|
||||||
|
|
|
@ -5,9 +5,6 @@ if (NOT CMAKE_BUILD_TYPE)
|
||||||
set(CMAKE_BUILD_TYPE Release)
|
set(CMAKE_BUILD_TYPE Release)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Create compile_commands.json
|
|
||||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
||||||
|
|
||||||
|
|
||||||
# =====COMPILER=====
|
# =====COMPILER=====
|
||||||
set(CMAKE_C_COMPILER "clang-10")
|
set(CMAKE_C_COMPILER "clang-10")
|
||||||
|
|
Reference in New Issue