aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authordavid <[email protected]>2026-07-23 22:12:42 -0300
committerdavid <[email protected]>2026-07-23 22:12:42 -0300
commit17881c653f333baa15f9e7b735466a0333a6cee6 (patch)
tree851c25695ca2433714383ecf697e2049e2a6c65e /Makefile
parent9765de97f1df3bed997eb341172ba4575f5376f3 (diff)
downloadpetratc-17881c653f333baa15f9e7b735466a0333a6cee6.tar.gz
petratc-17881c653f333baa15f9e7b735466a0333a6cee6.zip
fixed a couple bugs
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile11
1 files changed, 8 insertions, 3 deletions
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)