Use config.def.h instead of config.h

Since config.h is destined to be modified by the end-user, I think it
is better to adopt what suckless usually does and move config.h to
config.def.h. This file is sort of a template from which the end-user
can build their own config.h that won’t be tracked by git.

If config.h doesn’t exist at compile-time, the makefile will
automatically copy it from the template.
This commit is contained in:
Lucien Cartier-Tilet 2022-05-14 20:14:22 +02:00
parent e66bc2d5ab
commit 40aeb6bc59
No known key found for this signature in database
GPG Key ID: BD7789E705CB8DCA
3 changed files with 13 additions and 3 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/config.h

View File

@ -1,3 +1,4 @@
# -*- indent-tabs-mode: t -*-
CC = cc
CFLAGS = `pkg-config --cflags gtk4 webkit2gtk-5.0 x11`
LIBS = `pkg-config --libs gtk4 webkit2gtk-5.0 x11`
@ -18,10 +19,15 @@ OPTIONS = -Dgtk_doc=false -Dintrospection=false \
PREFIX=/usr/local
all:
all: config.h rose
rose:
$(CC) -fPIC -O3 -o rose *.c $(CFLAGS) $(LIBS) $(OPTIONS)
strip ./rose
config.h:
[ -f "$@" ] || cp config.def.h $@
install: all
cp -f ./rose $(PREFIX)/bin/rose
cp -f ./scripts/dmenu_rose.sh $(PREFIX)/bin/dmenu_rose
@ -32,8 +38,11 @@ uninstall:
clean:
rm -f rose compile_flags.txt
clean-all: clean
rm -f config.h
flags:
echo $(CFLAGS) | sed 's/ /\n/g' > compile_flags.txt
.PHONY: all clean install uninstall flags
.SILENT: all clean install uninstall flags
.PHONY: all clean clean-all install uninstall flags config.h
.SILENT: all clean clean-all install uninstall flags config.h