From 691f719a395f8916c06953e870034b36100ca51e Mon Sep 17 00:00:00 2001 From: Kirill Petrashin Date: Mon, 13 Jul 2026 20:58:51 +0300 Subject: Compile .c files into .o files --- Makefile | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 8dee31f..0a6b464 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,20 @@ +# TODO: separate build dir to avoid the *.o clutter? + CC=clang EXECUTABLE=astar +CFLAGS=-Wall -Wpedantic -Wextra -Werror -O3 +LIBS=-lncurses +OBJS=priority_queue.o map.o stack.o path.o bmp.o main.o + +$(EXECUTABLE): $(OBJS) + $(CC) $(CFLAGS) $(OBJS) -o $(EXECUTABLE) $(LIBS) -astar: *.c *.h - $(CC) -Wall -Wpedantic -Wextra -Werror -O3 -o $(EXECUTABLE) priority_queue.c map.c stack.c path.c bmp.c main.c -lncurses +$(OBJ): %.o: %.c + $(CC) $(CFLAGS) -c -o $@ $^ debug: *.c *.h $(CC) -Wall -g -o $(EXECUTABLE) -DPID_MESSAGE priority_queue.c map.c stack.c path.c bmp.c main.c -lncurses .PHONY: clean clean: - rm ./$(EXECUTABLE) + rm $(EXECUTABLE) $(OBJS) -- cgit v1.2.3