aboutsummaryrefslogtreecommitdiff
path: root/makefile
diff options
context:
space:
mode:
authorAleksey Veresov <aleksey@veresov.pro>2019-09-13 18:50:34 +0300
committerAleksey Veresov <aleksey@veresov.pro>2019-09-13 18:50:34 +0300
commitad6188f911af896c9c77e9215bea3c5c2a4e6cc3 (patch)
tree158b4015ff302f72fe2bb8a0ee3d5441ffb66719 /makefile
downloadmagi-ad6188f911af896c9c77e9215bea3c5c2a4e6cc3.tar
magi-ad6188f911af896c9c77e9215bea3c5c2a4e6cc3.tar.xz
magi-ad6188f911af896c9c77e9215bea3c5c2a4e6cc3.zip
Project name and license are added. Minor changes.
Diffstat (limited to 'makefile')
-rw-r--r--makefile40
1 files changed, 40 insertions, 0 deletions
diff --git a/makefile b/makefile
new file mode 100644
index 0000000..cf3385e
--- /dev/null
+++ b/makefile
@@ -0,0 +1,40 @@
+# Debug mode:
+# DEBUG = yes
+# Error logging (writes to stderr):
+# ERRLOG = yes
+
+CC = gcc
+LIB = libcgi.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