I've made config.mk a little bit simpler by using PKG_CONFIG to fetch libs and 
cflags for x11 and xft and also extracting all dependencies into a single 
variable.

I've tried to compile st without -lm and -lrt without problems, but I don't 
know if they are still needed, so I kept them. The same apply to both X11INC 
and X11LIB

---
 config.mk | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/config.mk b/config.mk
index c070a4a..96212e0 100644
--- a/config.mk
+++ b/config.mk
@@ -12,13 +12,13 @@ X11LIB = /usr/X11R6/lib

 PKG_CONFIG = pkg-config

+DEPS = fontconfig freetype2 x11 xft
+
 # includes and libs
 INCS = -I$(X11INC) \
-       `$(PKG_CONFIG) --cflags fontconfig` \
-       `$(PKG_CONFIG) --cflags freetype2`
-LIBS = -L$(X11LIB) -lm -lrt -lX11 -lutil -lXft \
-       `$(PKG_CONFIG) --libs fontconfig` \
-       `$(PKG_CONFIG) --libs freetype2`
+       `$(PKG_CONFIG) --cflags $(DEPS)`
+LIBS = -L$(X11LIB) -lm -lrt -lutil \
+       `$(PKG_CONFIG) --libs $(DEPS)`

 # flags
 STCPPFLAGS = -DVERSION=\"$(VERSION)\" -D_XOPEN_SOURCE=600
@@ -27,9 +27,8 @@ STLDFLAGS = $(LIBS) $(LDFLAGS)

 # OpenBSD:
 #CPPFLAGS = -DVERSION=\"$(VERSION)\" -D_XOPEN_SOURCE=600 -D_BSD_SOURCE
-#LIBS = -L$(X11LIB) -lm -lX11 -lutil -lXft \
-#       `$(PKG_CONFIG) --libs fontconfig` \
-#       `$(PKG_CONFIG) --libs freetype2`
+#LIBS = -L$(X11LIB) -lm -lutil \
+#       `$(PKG_CONFIG) --libs $(DEPS)`

 # compiler and linker
 # CC = c99
--
2.27.0



Reply via email to