41 lines
1020 B
Makefile
41 lines
1020 B
Makefile
MAKEFLAGS := --jobs=16
|
|
# MAKEFLAGS += --output-sync=target
|
|
|
|
# compiling with C++26
|
|
CXXFLAGS := -std=c++2c -fdiagnostics-color=always -Iinclude -lwebsockets -lz -Wall -Wpedantic -Wextra
|
|
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
|