aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile12
1 files changed, 9 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index b0c4f7f..2f43535 100644
--- a/Makefile
+++ b/Makefile
@@ -2,13 +2,16 @@ CC = gcc
CFLAGS = -Wall -Wextra -O2 -pipe
TARGET = timetolocal
SRC = $(wildcard *.c)
+OBJ = $(SRC:.c=.o)
PREFIX = /usr/local
all: $(TARGET)
$(TARGET): $(OBJ)
- @mkdir -p $(@D)
- $(CC) $(CFLAGS) -o $(TARGET) $(SRC)
+ $(CC) $(CFLAGS) -o $(TARGET) $(OBJ)
+
+%.o: %.c
+ $(CC) $(CFLAGS) -c $< -o $@
install: $(TARGET)
install -D $(TARGET) $(DESTDIR)$(PREFIX)/bin/$(notdir $(TARGET))
@@ -17,4 +20,7 @@ uninstall:
rm -f $(DESTDIR)$(PREFIX)/bin/$(notdir $(TARGET))
clean:
- rm -rf $(TARGET)
+ rm -f $(TARGET) $(OBJ)
+
+.PHONY: all install uninstall clean
+