sane makefile, sane structure, lots of updates
This commit is contained in:
41
Makefile
41
Makefile
@@ -1,13 +1,40 @@
|
||||
MAKEFLAGS := --jobs=$(shell nproc)
|
||||
MAKEFLAGS := --jobs=16
|
||||
# MAKEFLAGS += --output-sync=target
|
||||
|
||||
# compiling with C++26
|
||||
BUILD_OPTS = -std=c++2c -Ofast -fdiagnostics-color=always
|
||||
CXXFLAGS := -std=c++2c -Ofast -fdiagnostics-color=always -Iinclude
|
||||
# CXXFLAGS += -MMD -MP
|
||||
|
||||
build:
|
||||
g++ -c $(BUILD_OPTS) -o main.o main.cpp
|
||||
g++ -c $(BUILD_OPTS) -o LCDDisplay.o -Iinclude include/LCDDisplay.cpp
|
||||
g++ $(BUILD_OPTS) -o linuxSmartie LCDDisplay.o main.o
|
||||
SOURCES := main.cpp $(wildcard src/*.cpp)
|
||||
OBJECTS := $(SOURCES:.cpp=.o)
|
||||
# DEPS := $(OBJECTS:.o=.d)
|
||||
|
||||
TEST_SRC := test.cpp $(wildcard src/*.cpp)
|
||||
TEST_OBJS := $(TEST_SRC:.cpp=.o)
|
||||
|
||||
# glowny target, linkuje linuxSmartie, potrzebuje ${OBJECTS}
|
||||
linuxSmartie: $(OBJECTS)
|
||||
g++ $(CXXFLAGS) -o $@ $^
|
||||
|
||||
# kompiluje test.cpp zamiast main.cpp
|
||||
test: $(TEST_OBJS)
|
||||
g++ $(CXXFLAGS) -o $@ $^
|
||||
|
||||
# kompiluje obiekty, potrzebuje zrodel cpp
|
||||
%.o: %.cpp
|
||||
g++ $(CXXFLAGS) -c $< -o $@
|
||||
|
||||
# -include $(DEPS)
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm linuxSmartie *.o
|
||||
rm -f linuxSmartie $(OBJECTS) $(DEPS) $(TEST_OBJS)
|
||||
|
||||
|
||||
# build:
|
||||
# g++ -c $(BUILD_OPTS) -o LCDDisplay.o -Iinclude include/LCDDisplay.cpp
|
||||
# g++ -c $(BUILD_OPTS) -o gpu.o -Iinclude include/gpu.cpp
|
||||
# g++ -c $(BUILD_OPTS) -o utils.o -Iinclude include/utils.cpp
|
||||
# g++ -c $(BUILD_OPTS) -o main.o main.cpp
|
||||
|
||||
# g++ $(BUILD_OPTS) -o linuxSmartie *.o # linking
|
||||
|
||||
Reference in New Issue
Block a user