aboutsummaryrefslogtreecommitdiff
path: root/kociemba/Makefile
diff options
context:
space:
mode:
authorkartofen <mladenovnasko0@gmail.com>2023-12-25 01:45:05 +0200
committerkartofen <mladenovnasko0@gmail.com>2023-12-25 01:45:05 +0200
commit4b0fdca8673c76cb2305db301a3b36e9e3822e02 (patch)
treebbcf1c6364baba0afe9a2a595f4a579ad0946188 /kociemba/Makefile
Diffstat (limited to 'kociemba/Makefile')
-rw-r--r--kociemba/Makefile44
1 files changed, 44 insertions, 0 deletions
diff --git a/kociemba/Makefile b/kociemba/Makefile
new file mode 100644
index 0000000..61fa1aa
--- /dev/null
+++ b/kociemba/Makefile
@@ -0,0 +1,44 @@
+CC := gcc
+AR := ar
+
+ifeq ($(PROD),1)
+CFLAGS := -std=c99 -O2 # production flags
+else
+CFLAGS := -std=c99 -Wall -Wextra -Wpedantic -g -DDEBUG # debug flags
+endif
+
+SRCD := src
+OBJD := obj
+BIND := bin
+
+FILES = $(shell find $(SRCD)/ -type f 2> /dev/null)
+CSRCS = $(filter %.c, $(FILES))
+COBJS = $(CSRCS:$(SRCD)/%.c=$(OBJD)/%.o)
+
+CDEPS = $(COBJS:%.o=%.d)
+-include $(CDEPS)
+
+NAME := kociemba
+
+all: standalone lib
+
+standalone $(NAME): $(BIND)/$(NAME)
+static $(NAME).a: $(BIND)/$(NAME).a
+
+clean:
+ rm -rf $(OBJD)
+ rm -rf $(BIND)
+
+$(OBJD)/%.o: $(SRCD)/%.c
+ @mkdir -p $(dir $@)
+ $(CC) $(CFLAGS) -MMD -MF $(@:%.o=%.d) -c $< -o $@
+
+$(BIND)/$(NAME): $(COBJS)
+ @mkdir -p $(dir $@)
+ $(CC) $(CFLAGS) $^ -o $@
+
+$(BIND)/$(NAME).a: $(COBJS)
+ @mkdir -p $(dir $@)
+ $(AR) rsc $@ $^
+
+.PHONY: all standalone lib clean $(NAME) $(NAME).a