From a5ec437e91f90f25711c7e1b47b8238fdae6b103 Mon Sep 17 00:00:00 2001 From: Aleksey Veresov Date: Wed, 16 Oct 2019 18:37:32 +0300 Subject: [magi] Cosmetic fixes. --- Makefile | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 Makefile (limited to 'Makefile') diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..9585f98 --- /dev/null +++ b/Makefile @@ -0,0 +1,40 @@ +# Debug mode: +# DEBUG = yes +# Error logging (writes to stderr): +# ERRLOG = yes + +CC = gcc +LIB = libmagi.a + +CFLAGS = -xc -ansi -pedantic -Wall +ifeq '$(DEBUG)' 'yes' +CFLAGS += -g -O0 +else +CFLAGS += -O3 +endif +ifeq '$(ERRLOG)' 'yes' +CFLAGS += -D ERRLOG +endif + +SRC_DIR = src +SRC = $(wildcard $(SRC_DIR)/*.c) +OBJ = $(SRC:.c=.o) + + +default: $(LIB) + +ifneq "clean" "$(MAKECMDGOALS)" +-include deps.mk +endif + +deps.mk: $(SRC) + $(CC) -MM $^ > $@ + +%.o: %.c %.h + $(CC) $(CFLAGS) -c $< -o $@ + +$(LIB): $(OBJ) + ar rcs $@ $^ + +clean: + rm -f $(OBJ) $(LIB) deps.mk -- cgit v1.2.3