From 17881c653f333baa15f9e7b735466a0333a6cee6 Mon Sep 17 00:00:00 2001 From: david Date: Thu, 23 Jul 2026 22:12:42 -0300 Subject: fixed a couple bugs --- Makefile | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 939c4c4..9bbfb11 100644 --- a/Makefile +++ b/Makefile @@ -3,10 +3,11 @@ CFLAGS = -Wall -Wextra -O2 -pipe LDLIBS = -lncurses -ltinfo TARGET = petratc SRC = petratc.c rat.c $(wildcard games/*.c) +OBJ = $(SRC:%.c=obj/%.o) PREFIX = /usr/local -$(TARGET): $(SRC) - $(CC) $(CFLAGS) -o $(TARGET) $(SRC) $(LDLIBS) +$(TARGET): $(OBJ) + $(CC) $(CFLAGS) -o $(TARGET) $(OBJ) $(LDLIBS) install: $(TARGET) install -D $(TARGET) $(DESTDIR)$(PREFIX)/bin/$(TARGET) @@ -14,5 +15,9 @@ install: $(TARGET) uninstall: rm -f $(DESTDIR)$(PREFIX)/bin/$(TARGET) +obj/%.o: %.c + @mkdir -p $(@D) + $(CC) $(CFLAGS) -c $< -o $@ + clean: - rm -f $(TARGET) + rm -f $(TARGET) $(OBJ) -- cgit v1.3-2-g0d8e