2025-01-10 08:15:31 +01:00
|
|
|
CXXFLAGS ?= -Wall -Wextra -O2 -g0 -std=c++23 -I../common/
|
|
|
|
MAKEFLAGS += --no-print-directory
|
|
|
|
|
|
|
|
.PRECIOUS: %.o
|
|
|
|
.PRECIOUS: %.asm
|
|
|
|
|
2025-01-11 17:43:29 +01:00
|
|
|
TARGET ?= main.elf
|
|
|
|
SRCS ?= $(wildcard *.cc)
|
|
|
|
HDRS ?= $(wildcard *.h)
|
|
|
|
|
2025-01-10 08:15:31 +01:00
|
|
|
OBJS = $(SRCS:.cc=.o)
|
|
|
|
ASMS = $(SRCS:.cc=.asm)
|
|
|
|
|
|
|
|
all: $(TARGET) $(ASMS)
|
|
|
|
$(TARGET): $(OBJS)
|
|
|
|
|
2025-01-11 17:43:29 +01:00
|
|
|
test: $(TARGET)
|
|
|
|
./$(TARGET)
|
|
|
|
|
|
|
|
check: $(SRCS) $(HDRS)
|
|
|
|
cppcheck --language=c++ $^
|
|
|
|
|
2025-01-10 08:15:31 +01:00
|
|
|
asm: $(ASMS)
|
|
|
|
|
|
|
|
%.o: %.cc
|
|
|
|
@echo CC $@
|
|
|
|
@g++ $(CXXFLAGS) -c $< -o $@
|
|
|
|
|
|
|
|
%.asm: %.o
|
|
|
|
@echo DEC $@
|
|
|
|
@objdump -d -M intel $< > $@
|
|
|
|
|
|
|
|
%.elf: %.o | %.asm
|
|
|
|
@echo CC/LD $@
|
|
|
|
@g++ $(CXXFLAGS) -o $@ $^
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f *.elf *.asm *.o
|
|
|
|
|
2025-01-11 17:43:29 +01:00
|
|
|
.PHONY: clean all asm check test
|