summaryrefslogtreecommitdiff
path: root/gastro/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'gastro/Makefile')
-rw-r--r--gastro/Makefile53
1 files changed, 53 insertions, 0 deletions
diff --git a/gastro/Makefile b/gastro/Makefile
new file mode 100644
index 0000000..9a99afd
--- /dev/null
+++ b/gastro/Makefile
@@ -0,0 +1,53 @@
+CC ?= gcc
+AR ?= ar
+override CPPFLAGS += -MMD -MP
+override CFLAGS += -O2 --std=c99 -g -Ideps/ -Isrc/ -Iinclude/ -Wall -Wextra -Wconversion -Wformat-security -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wnull-dereference -Wfloat-equal -Wundef -Wpointer-arith -Wbad-function-cast -Wlogical-op -Wmissing-braces -Wcast-align -Wstrict-overflow=5
+override LDFLAGS += -g -lraylib -lcolonq-qoi
+
+BUILD = build_$(CC)
+
+SRCS := src/gastro.c src/trig.c
+CHK_SOURCES ?= $(SRCS)
+OBJECTS := $(SRCS:src/%.c=$(BUILD)/%.o)
+EXE := gastro
+LIB := libcolonq-gastro.a
+
+prefix ?= /usr/local
+exec_prefix ?= $(prefix)
+bindir ?= $(exec_prefix)/bin
+includedir ?= $(prefix)/include
+libdir ?= $(exec_prefix)/lib
+
+.PHONY: all clean install check-syntax
+
+all: $(EXE) $(LIB)
+
+$(EXE): $(BUILD)/main.o $(OBJECTS)
+ $(CC) -o $@ $^ $(LDFLAGS)
+
+$(LIB): $(OBJECTS)
+ ar rcs $@ $^
+
+$(BUILD):
+ mkdir $(BUILD)/
+
+$(BUILD)/%.o: src/%.c | $(BUILD)
+ $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $<
+
+clean:
+ -rm $(EXE)
+ -rm -r $(BUILD)/
+
+TAGS: $(SRCS)
+ etags $^
+
+install: $(EXE) $(LIB)
+ mkdir -p $(DESTDIR)$(bindir) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir)
+ install $(EXE) $(DESTDIR)$(bindir)/$(EXE)
+ install $(LIB) $(DESTDIR)$(libdir)/$(LIB)
+ cp -r include/* $(DESTDIR)$(includedir)
+
+check-syntax: TAGS
+ gcc $(CFLAGS) -fsyntax-only $(CHK_SOURCES)
+
+-include $(OBJECTS:.o=.d)