aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile35
1 files changed, 35 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..f3fa3dd
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,35 @@
+RM = rm -f
+MKDIR = mkdir -p
+
+NAME = cardioid
+
+SRCDIR = src
+INCDIR = inc
+OBJDIR = obj
+
+CC = gcc
+CCFLAGS = -Wall -Wextra -I$(INCDIR) $(shell sdl2-config --cflags)
+LDFLAGS = $(shell sdl2-config --libs)
+
+SRC = $(shell find $(SRCDIR) -type f -name "*.c")
+INC = $(shell find $(INCDIR) -type f -name "*.h")
+OBJ = $(SRC:$(SRCDIR)/%.c=$(OBJDIR)/%.o)
+
+all: prebuild $(NAME)
+
+prebuild:
+ $(MKDIR) $(OBJDIR)
+
+$(NAME): $(OBJ)
+ $(CC) -o $@ $^ $(LDFLAGS)
+
+$(OBJDIR)/%.o: $(SRCDIR)/%.c $(INC)
+ $(CC) $(CCFLAGS) -c -o $@ $<
+
+clean:
+ $(RM) $(OBJ)
+
+fclean: clean
+ $(RM) $(NAME)
+
+re: fclean all