cpp_prac/config.mk

40 lines
618 B
Makefile

CXXFLAGS ?= -Wall -Wextra -O2 -g0 -std=c++23 -I../common/
MAKEFLAGS += --no-print-directory
.PRECIOUS: %.o
.PRECIOUS: %.asm
TARGET ?= main.elf
SRCS ?= $(wildcard *.cc)
HDRS ?= $(wildcard *.h)
OBJS = $(SRCS:.cc=.o)
ASMS = $(SRCS:.cc=.asm)
all: $(TARGET) $(ASMS)
$(TARGET): $(OBJS)
test: $(TARGET)
./$(TARGET)
check: $(SRCS) $(HDRS)
cppcheck --language=c++ $^
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
.PHONY: clean all asm check test