aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2020-05-19 13:22:59 +0200
committerCharles <sircharlesaze@gmail.com>2020-05-19 13:22:59 +0200
commit6a80b1b70ec069b051c0e31aafac6eb596e20261 (patch)
treeedf9856bcd2b4415796a2a49f0232ba830e69560 /Makefile
parentc5008a4e62fb83eb71f5f94f622c01f2d8fe8b6b (diff)
downloadmandelbrot_cpu-6a80b1b70ec069b051c0e31aafac6eb596e20261.tar.gz
mandelbrot_cpu-6a80b1b70ec069b051c0e31aafac6eb596e20261.tar.bz2
mandelbrot_cpu-6a80b1b70ec069b051c0e31aafac6eb596e20261.zip
Back to basic SDL application boilerplate
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile38
1 files changed, 22 insertions, 16 deletions
diff --git a/Makefile b/Makefile
index 11997f9..4fae640 100644
--- a/Makefile
+++ b/Makefile
@@ -1,34 +1,40 @@
+RM = rm -f
+
NAME = mandel
+
+SRC_DIR = src
+INC_DIR = inc
+OBJ_DIR = obj
+
CC = gcc
-CCFLAGS = -Wall -Wextra
+OFLAG = -O0
+CCFLAGS = -I$(INC_DIR) -Wall -Wextra $(OFLAG)
LDFLAGS = -lm -lpthread $(shell sdl2-config --libs --cflags)
-HEADER = header.h
-SRC = main.c graphics.c mandelbrot.c helper.c
-OBJ = $(SRC:.c=.o)
+INC = $(shell find $(INC_DIR) -type f -name '*.h')
+SRC = $(shell find $(SRC_DIR) -type f -name '*.c')
+OBJ = $(SRC:$(SRC_DIR)/%.c=$(OBJ_DIR)/%.o)
-RM = rm -f
+all: prebuild $(NAME)
-.PHONY: all
-all: $(NAME)
+prebuild:
+ mkdir -p $(OBJ_DIR)
$(NAME): $(OBJ)
- $(CC) $(LDFLAGS) $(CCFLAGS) -o $@ $(OBJ)
+ $(CC) -o $@ $(OBJ) $(LDFLAGS)
-%.o: %.c $(HEADER)
- $(CC) $(LDFLAGS) $(CCFLAGS) -c -o $@ $<
+$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c $(HEADER)
+ $(CC) $(CCFLAGS) -c -o $@ $<
-.PHONY: debug
-debug: CCFLAGS += -g -fsanitize=address
-debug: re
+debug: OFLAG = -g
+debug: all
-.PHONY: clean
clean:
$(RM) $(OBJ)
-.PHONY: fclean
fclean: clean
$(RM) $(NAME)
-.PHONY: re
re: fclean all
+
+.PHONY: all debug clean fclean re