aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile26
1 files changed, 26 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..ac37253
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,26 @@
+CC = gcc
+CFLAGS = -Wall -Wextra -O2 -pipe
+LDLIBS =
+TARGET = timetolocal
+SRC = $(wildcard *.c)
+OBJ = $(SRC:src/%.c=obj/%.o)
+PREFIX = /usr/local
+
+all: $(TARGET)
+
+$(TARGET): $(OBJ)
+ @mkdir -p $(@D)
+ $(CC) $(CFLAGS) -o $(TARGET) $(OBJ) $(LDLIBS)
+
+install: $(TARGET)
+ install -D $(TARGET) $(DESTDIR)$(PREFIX)/bin/$(notdir $(TARGET))
+
+uninstall:
+ rm -f $(DESTDIR)$(PREFIX)/bin/$(notdir $(TARGET))
+
+obj/%.o: src/%.c
+ @mkdir -p $(@D)
+ $(CC) $(CFLAGS) -c $< -o $@
+
+clean:
+ rm -rf obj/ $(TARGET)