commit: adfdc1f543588dae9426537b04b3874d76aaf010
parent: 2828da83db7bbba6b66234614c34aedf9a9eb284
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Fri, 15 Mar 2019 16:47:23 +0100
Makefile: cleaner usage of variables and make it easier to add exec targets
Diffstat:
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/Makefile b/Makefile
@@ -1,15 +1,23 @@
-LIBS = $(shell pkg-config --cflags --libs gtk+-3.0 webkit2gtk-4.0)
+CC ?= cc
+CFLAGS ?= -g -Wall -Wextra
PREFIX ?= /usr/local
-badwolf: badwolf.c config.h
- $(CC) $(CFLAGS) $(LIBS) -o $@ $<
+DEPS = gtk+-3.0 webkit2gtk-4.0
+CFLAGS += $(shell pkg-config --cflags $(DEPS))
+LDFLAGS += $(shell pkg-config --libs $(DEPS))
+OBJS = badwolf
+
+all: $(OBJS)
+
+.c:
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
install: badwolf
mkdir -p $(DESTDIR)$(PREFIX)/bin
cp -p badwolf $(DESTDIR)$(PREFIX)/bin/badwolf
clean:
- rm badwolf
+ rm $(OBJS)
format: *.c *.h
clang-format -style=file -assume-filename=.clang-format -i *.c *.h