use cmake
This commit is contained in:
36
Makefile
36
Makefile
@@ -1,31 +1,21 @@
|
||||
MAKEFLAGS := "-j $(shell nproc)"
|
||||
.PHONY: configure build clean nuke install install_service
|
||||
|
||||
# compiling with C++26
|
||||
CXXFLAGS := -std=c++2c -fdiagnostics-color=always -Iinclude -lwebsockets -lz -Wall -Wextra -Wpedantic -Werror
|
||||
CXXFLAGS += -MMD -MP
|
||||
CXXFLAGS += -O2 -s
|
||||
BUILD_DIR ?= build
|
||||
|
||||
SOURCES := $(wildcard src/*.cpp) main.cpp
|
||||
OBJECTS := $(SOURCES:.cpp=.o)
|
||||
DEPS := $(OBJECTS:.o=.d)
|
||||
configure:
|
||||
cmake -S . -B ${BUILD_DIR}
|
||||
|
||||
# glowny target, linkuje linuxSmartie, potrzebuje ${OBJECTS}, jest na samej górze wiec jest domyslny
|
||||
linuxSmartie: $(OBJECTS)
|
||||
g++ $(CXXFLAGS) -o $@ $^
|
||||
build:
|
||||
cmake --build ${BUILD_DIR} -j
|
||||
|
||||
# kompiluje obiekty, potrzebuje zrodel cpp
|
||||
%.o: %.cpp
|
||||
g++ $(CXXFLAGS) -c $< -o $@
|
||||
clean:
|
||||
cmake --build $(BUILD_DIR) --target clean
|
||||
|
||||
nuke: clean
|
||||
rm -rf $(BUILD_DIR)
|
||||
|
||||
-include $(DEPS)
|
||||
|
||||
.PHONY: clean cleanobj install_service
|
||||
|
||||
cleanobj:
|
||||
rm -f $(OBJECTS) $(DEPS) $(TEST_OBJS)
|
||||
|
||||
clean: cleanobj
|
||||
rm -f linuxSmartie
|
||||
install:
|
||||
install ${BUILD}/linuxSmartie ${HOME}/.local/bin
|
||||
|
||||
install_service:
|
||||
mkdir -p ~/.config/systemd/user
|
||||
|
||||
Reference in New Issue
Block a user