mgen/Makefile

28 lines
1 KiB
Makefile
Raw Normal View History

2023-12-13 16:27:29 +00:00
TARGET = foo
CC = gcc
CFLAGS = -std=c99
LDLIBS = -lm
#=mgen_start=#
BUILDDIR = ./build
OBJDIR = $(BUILDDIR)/obj
$(BUILDDIR)/$(TARGET): $(OBJDIR)/main.o $(OBJDIR)/ops.o $(OBJDIR)/traps.o | $(OBJDIR) $(BUILDDIR)
$(CC) $(LDFLAGS) -o $(BUILDDIR)/$(TARGET) $(OBJDIR)/main.o $(OBJDIR)/ops.o $(OBJDIR)/traps.o $(LDLIBS)
$(OBJDIR)/main.o: ./testing_grounds/src/main.c ./testing_grounds/src/main.h ./testing_grounds/src/ops.h ./testing_grounds/src/traps.h | $(OBJDIR)
$(CC) $(CFLAGS) -o $(OBJDIR)/main.o -c ./testing_grounds/src/main.c
$(OBJDIR)/ops.o: ./testing_grounds/src/ops.c ./testing_grounds/src/main.h | $(OBJDIR)
$(CC) $(CFLAGS) -o $(OBJDIR)/ops.o -c ./testing_grounds/src/ops.c
$(OBJDIR)/traps.o: ./testing_grounds/src/traps.c ./testing_grounds/src/traps.h ./testing_grounds/src/main.h | $(OBJDIR)
$(CC) $(CFLAGS) -o $(OBJDIR)/traps.o -c ./testing_grounds/src/traps.c
$(BUILDDIR):
mkdir -p $(BUILDDIR)
$(OBJDIR):
mkdir -p $(OBJDIR)
.PHONY: clean
clean:
rm -r $(OBJDIR)
rm -r $(BUILDDIR)
.PHONY: run
run: $(BUILDDIR)/$(TARGET)
./$(BUILDDIR)/$(TARGET)
#=mgen_end=#