naegling/Makefile
Simon Brooke 882f991db4 Day 1. Assembly code is being generated, on a monkey see, monkey do basis;
but it doesn't link because of a missing library; and having moved source
files around the Makefile currently doesn't work.
2026-04-06 09:48:44 +01:00

33 lines
776 B
Makefile

PROJECT_ROOT = $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
OBJS = grendel.o
ifeq ($(BUILD_MODE),debug)
CFLAGS += -g -O0
else ifeq ($(BUILD_MODE),run)
CFLAGS += -O2
else ifeq ($(BUILD_MODE),profile)
CFLAGS += -g -pg -fprofile-arcs -ftest-coverage
LDFLAGS += -pg -fprofile-arcs -ftest-coverage
EXTRA_CLEAN += grendel.gcda grendel.gcno $(PROJECT_ROOT)gmon.out
EXTRA_CMDS = rm -rf grendel.gcda
else
$(error Build mode $(BUILD_MODE) not supported by this Makefile)
endif
SRC_DIR=$(PROJECT_ROOT)/src/c
all: grendel
grendel: $(OBJS)
$(CXX) $(LDFLAGS) -o $@ $^
$(EXTRA_CMDS)
# %.o: $(SRC_DIR)/%.cpp
# $(CXX) -c $(CFLAGS) $(CXXFLAGS) $(CPPFLAGS) -o $@ $<
%.o: $(SRC_DIR)/%.c
$(CC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
clean:
rm -fr grendel $(OBJS) $(EXTRA_CLEAN)