From c8abf8396008f6caf45b6a17cb6247962ee26d89 Mon Sep 17 00:00:00 2001 From: Noah Swerhun Date: Fri, 11 Feb 2022 15:10:09 -0600 Subject: [PATCH] added pkg-config functionality --- cbuild.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cbuild.sh b/cbuild.sh index 8256684..620e486 100755 --- a/cbuild.sh +++ b/cbuild.sh @@ -14,6 +14,8 @@ SRCDIR="src" OBJDIR="obj" MAKEFILE=".makefile" +PKG_CONFIG_LIBS="" + HEADER_DIR="include" # ------------------- @@ -26,6 +28,9 @@ OBJ="$(find ${SRCDIR} -name '*\.c' 2> /dev/null | srcnum="$(find ${SRCDIR} -name '*\.c' -exec printf %c {} + 2> /dev/null | wc -c)" +CFLAGS="${CFLAGS} $(pkg-config --cflags "${PKG_CONFIG_LIBS}")" +LDLIBS="${CFLAGS} $(pkg-config --libs "${PKG_CONFIG_LIBS}")" + clear_formatting="\033[0m" bold="\033[1m" info_color="\033[34m" # default: "\033[34m" - blue @@ -54,6 +59,9 @@ Customization: (default: src) OBJDIR the directory where compiled objects will be placed. (default: obj) MAKEFILE the filename of the generated makefile (default: .makefile) + + PKG_CONFIG_LIBS uses flags generated by pkg-config for the given library + name. HEADER_DIR the directory in which header files will be placed by the 'new' command. Note that this is relative to SRCDIR. Setting this to