Files
linuxSmartie/Makefile
2025-10-05 16:32:01 +02:00

41 lines
995 B
Makefile

MAKEFLAGS := --jobs=16
# MAKEFLAGS += --output-sync=target
# compiling with C++26
CXXFLAGS := -std=c++2c -fdiagnostics-color=always -Iinclude -lwebsockets -lz
CXXFLAGS += -MMD -MP
CXXFLAGS += -O2 -s
SOURCES := $(wildcard src/*.cpp)
OBJECTS := $(SOURCES:.cpp=.o)
DEPS := $(OBJECTS:.o=.d)
# glowny target, linkuje linuxSmartie, potrzebuje ${OBJECTS}, jest na samej górze wiec jest domyslny
linuxSmartie: main.o $(OBJECTS)
g++ $(CXXFLAGS) -o $@ $^
# kompiluje test.cpp zamiast main.cpp
test: test.o $(OBJECTS)
g++ $(CXXFLAGS) -o $@ $^
# kompiluje obiekty, potrzebuje zrodel cpp
%.o: %.cpp
g++ $(CXXFLAGS) -c $< -o $@
-include $(DEPS)
.PHONY: clean cleanobj install_service
cleanobj:
rm -f $(OBJECTS) $(DEPS) $(TEST_OBJS)
clean: cleanobj
rm -f linuxSmartie
install_service:
mkdir -p ~/.config/systemd/user
cp linuxSmartie.service ~/.config/systemd/user/linuxSmartie.service
systemctl --user daemon-reload
systemctl --user enable linuxSmartie
systemctl --user start linuxSmartie