From 750bcb00a1ff63f78ddde9e444e1e0d741da3534 Mon Sep 17 00:00:00 2001 From: Emil Date: Wed, 2 Aug 2023 07:45:58 -0600 Subject: [PATCH] Added additional build system: make, utop existing unity build. --- .gitignore | 1 + Makefile | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 Makefile diff --git a/.gitignore b/.gitignore index 1efc265..c2bf155 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ +build **/*.out **/*.o diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..608da0b --- /dev/null +++ b/Makefile @@ -0,0 +1,46 @@ +.POSIX: # Just kidding, use GNU Make + +# OVERRIDE ME # +PREFIX := . +PROGN := probotic + +CC := cc +CFLAGS := -std=c99 -Wall -Wextra -Wpedantic +CPPFLAGS := -I/usr/bin/ircclient/ +LDFLAGS := -lircclient + +SRC.DIR := src +OBJ.DIR := $(PREFIX)/obj +# INC.DIR := include + +OBJ := $(addprefix $(OBJ.DIR)/, fetch.c main.c) +# HDR := + +VPATH := $(INC.DIR) $(SRC.DIR) $(OBJ.DIR) + +ifeq ($(DEBUG),1) + CFLAGS += -Og -g3 +else + CFLAGS += -O3 -flto=auto -fomit-frame-pointer +endif + +ifdef SAN + CFLAGS += -fsanitize=$(SAN) +endif + +CPPFLAGS += -DPROGN="\"$(PROGN)\"" + +$(OBJ.DIR)/%.o: $(SRC.DIR)/%.c + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< + +$(PREFIX)/$(PROGN): $(VPATH) $(PREFIX) $(HDR) | $(OBJ) + $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $| $(LDFLAGS) + +# include/config.h: include/config.mk.h +# cp -f $< $@ + +$(VPATH) $(PREFIX): + mkdir -p $@ + +clean: + $(RM) $(OBJ) $(PROGN)