diff --git a/c3s/configure b/c3s/configure
index 6455fc9..9e09d11 100755
--- a/c3s/configure
+++ b/c3s/configure
@@ -14,6 +14,7 @@
set -e
export SRC_TOP="$(dirname "$PWD")"
+CONFIG_H_PREFIX=C3S_
. ../config.subr
@@ -39,7 +40,7 @@ OBJECTS_DEBUG="$(c2ext .debug.lo "$SOURCES")"
echo "OBJECTS_DEBUG = $OBJECTS_DEBUG" >> ${CONFIG_MK}
# Common config for all targets
-CFLAGS="$CFLAGS -W -Wall -Werror -std=c11 -pedantic -fPIC"
+CFLAGS="$CFLAGS -W -Wall -Werror -std=c11 -pedantic -pipe"
LDFLAGS="$LDFLAGS -rdynamic"
config_asan
config_gnu
@@ -51,7 +52,8 @@ config_lib dl -ldl 2>/dev/null
LIBS="$LIBS -pthread -lm"
# Asan config
-CFLAGS_ASAN="$CFLAGS -fsanitize=address -O1 -fno-omit-frame-pointer -g"
+CFLAGS_ASAN="$CFLAGS -DDEBUG -O1 -g"
+CFLAGS_ASAN="$CFLAGS_ASAN -fsanitize=address -fno-omit-frame-pointer"
LDFLAGS_ASAN="$LDFLAGS"
LIBC3_ASAN=../libc3/libc3_asan.la
LOCAL_LIBS_ASAN="$LIBC3_ASAN"
@@ -72,7 +74,7 @@ LOCAL_LIBS_DEBUG="$LIBC3_DEBUG"
LIBS_DEBUG="$LOCAL_LIBS_DEBUG $LIBS"
# Main config
-DEFAULT_CFLAGS="-O2 -pipe"
+DEFAULT_CFLAGS="-O2 -fPIC"
if [ "x$ENV_CFLAGS" = "x" ]; then
CFLAGS="$CFLAGS $DEFAULT_CFLAGS"
fi
@@ -99,46 +101,10 @@ echo "CFLAGS_DEBUG = $CFLAGS_DEBUG" >> ${CONFIG_MK}
echo "LDFLAGS_DEBUG = $LDFLAGS_DEBUG" >> ${CONFIG_MK}
echo "LIBS_DEBUG = $LIBS_DEBUG" >> ${CONFIG_MK}
-echo >> ${CONFIG_MK}
-echo "$PROG: $LOCAL_LIBS $OBJECTS" >> ${CONFIG_MK}
-echo " ${LIBTOOL} --tag=CC --mode=link \${CC} \${CFLAGS} \${LDFLAGS} ${OBJECTS} ${LIBS} -o $PROG" >> ${CONFIG_MK}
-
-echo >> ${CONFIG_MK}
-echo "$PROG_ASAN: $LOCAL_LIBS_ASAN $OBJECTS_ASAN" >> ${CONFIG_MK}
-echo " ${LIBTOOL} --tag=CC --mode=link \${CC} \${CFLAGS_ASAN} \${LDFLAGS_ASAN} ${OBJECTS_ASAN} ${LIBS_ASAN} -o $PROG_ASAN" >> ${CONFIG_MK}
+update_build
+update_build_prog
-if $HAVE_GCOV; then
- echo >> ${CONFIG_MK}
- echo "$PROG_COV: $LOCAL_LIBS_COV $OBJECTS_COV" >> ${CONFIG_MK}
- echo " ${LIBTOOL} --tag=CC --mode=link \${CC} \${CFLAGS_COV} \${LDFLAGS_COV} ${OBJECTS_COV} ${LIBS_COV} -o $PROG_COV" >> ${CONFIG_MK}
-fi
-
-echo >> ${CONFIG_MK}
-echo "$PROG_DEBUG: $LOCAL_LIBS_DEBUG $OBJECTS_DEBUG" >> ${CONFIG_MK}
-echo " ${LIBTOOL} --tag=CC --mode=link \${CC} \${CFLAGS_DEBUG} \${LDFLAGS_DEBUG} ${OBJECTS_DEBUG} ${LIBS_DEBUG} -o $PROG_DEBUG" >> ${CONFIG_MK}
-
-for SRC in $SOURCES; do
- echo >> ${CONFIG_MK}
- SRC_LO="$(c2ext .main.lo "$SRC")"
- c_ext_rule .main.lo "$SRC" >> ${CONFIG_MK}
- echo " ${LIBTOOL} --tag=CC --mode=compile \${CC} \${CPPFLAGS} \${CFLAGS} -c $SRC -o $SRC_LO" >> ${CONFIG_MK}
-
- echo >> ${CONFIG_MK}
- SRC_ASAN_LO="$(c2ext .asan.lo "$SRC")"
- c_ext_rule .asan.lo "$SRC" >> ${CONFIG_MK}
- echo " ${LIBTOOL} --tag=CC --mode=compile \${CC} \${CPPFLAGS} \${CFLAGS_ASAN} -c $SRC -o $SRC_ASAN_LO" >> ${CONFIG_MK}
-
- if $HAVE_GCOV; then
- echo >> ${CONFIG_MK}
- SRC_COV_LO="$(c2ext .cov.lo "$SRC")"
- c_ext_rule .cov.lo "$SRC" >> ${CONFIG_MK}
- echo " ${LIBTOOL} --tag=CC --mode=compile \${CC} \${CPPFLAGS} \${CFLAGS_COV} -c $SRC -o $SRC_COV_LO" >> ${CONFIG_MK}
- fi
-
- echo >> ${CONFIG_MK}
- SRC_DEBUG_LO="$(c2ext .debug.lo "$SRC")"
- c_ext_rule .debug.lo "$SRC" >> ${CONFIG_MK}
- echo " ${LIBTOOL} --tag=CC --mode=compile \${CC} \${CPPFLAGS} \${CFLAGS_DEBUG} -c $SRC -o $SRC_DEBUG_LO" >> ${CONFIG_MK}
-done
+build_lo
+build_prog
update_config_mk
diff --git a/ic3/configure b/ic3/configure
index 4a1afbd..fb42f3a 100755
--- a/ic3/configure
+++ b/ic3/configure
@@ -66,7 +66,8 @@ OBJECTS_DEBUG="$(c2ext .debug.lo "$SOURCES")"
echo "OBJECTS_DEBUG = $OBJECTS_DEBUG" >> ${CONFIG_MK}
# Asan config
-CFLAGS_ASAN="$CFLAGS -fsanitize=address -O1 -fno-omit-frame-pointer -g"
+CFLAGS_ASAN="$CFLAGS -DDEBUG -O1 -g"
+CFLAGS_ASAN="$CFLAGS_ASAN -fsanitize=address -fno-omit-frame-pointer"
LDFLAGS_ASAN="$LDFLAGS"
LIBC3_ASAN=../libc3/libc3_asan.la
LOCAL_LIBS_ASAN="$LIBC3_ASAN"
@@ -87,7 +88,7 @@ LOCAL_LIBS_DEBUG="$LIBC3_DEBUG"
LIBS_DEBUG="$LOCAL_LIBS_DEBUG $LIBS"
# Main config
-DEFAULT_CFLAGS="-O2 -pipe"
+DEFAULT_CFLAGS="-O2 -fPIC"
if [ "x$ENV_CFLAGS" = "x" ]; then
CFLAGS="$CFLAGS $DEFAULT_CFLAGS"
fi
@@ -114,46 +115,10 @@ echo "CFLAGS_DEBUG = $CFLAGS_DEBUG" >> ${CONFIG_MK}
echo "LDFLAGS_DEBUG = $LDFLAGS_DEBUG" >> ${CONFIG_MK}
echo "LIBS_DEBUG = $LIBS_DEBUG" >> ${CONFIG_MK}
-echo >> ${CONFIG_MK}
-echo "$PROG: $LOCAL_LIBS $OBJECTS" >> ${CONFIG_MK}
-echo " ${LIBTOOL} --tag=CC --mode=link \${CC} \${CFLAGS} \${LDFLAGS} ${OBJECTS} ${LIBS} -o $PROG" >> ${CONFIG_MK}
-
-echo >> ${CONFIG_MK}
-echo "$PROG_ASAN: $LOCAL_LIBS_ASAN $OBJECTS_ASAN" >> ${CONFIG_MK}
-echo " ${LIBTOOL} --tag=CC --mode=link \${CC} \${CFLAGS_ASAN} \${LDFLAGS_ASAN} ${OBJECTS_ASAN} ${LIBS_ASAN} -o $PROG_ASAN" >> ${CONFIG_MK}
+update_build
+update_build_prog
-if $HAVE_GCOV; then
- echo >> ${CONFIG_MK}
- echo "$PROG_COV: $LOCAL_LIBS_COV $OBJECTS_COV" >> ${CONFIG_MK}
- echo " ${LIBTOOL} --tag=CC --mode=link \${CC} \${CFLAGS_COV} \${LDFLAGS_COV} ${OBJECTS_COV} ${LIBS_COV} -o $PROG_COV" >> ${CONFIG_MK}
-fi
-
-echo >> ${CONFIG_MK}
-echo "$PROG_DEBUG: $LOCAL_LIBS_DEBUG $OBJECTS_DEBUG" >> ${CONFIG_MK}
-echo " ${LIBTOOL} --tag=CC --mode=link \${CC} \${CFLAGS_DEBUG} \${LDFLAGS_DEBUG} ${OBJECTS_DEBUG} ${LIBS_DEBUG} -o $PROG_DEBUG" >> ${CONFIG_MK}
-
-for SRC in $SOURCES; do
- echo >> ${CONFIG_MK}
- SRC_LO="$(c2ext .main.lo "$SRC")"
- c_ext_rule .main.lo "$SRC" >> ${CONFIG_MK}
- echo " ${LIBTOOL} --tag=CC --mode=compile \${CC} \${CPPFLAGS} \${CFLAGS} -c $SRC -o $SRC_LO" >> ${CONFIG_MK}
-
- echo >> ${CONFIG_MK}
- SRC_ASAN_LO="$(c2ext .asan.lo "$SRC")"
- c_ext_rule .asan.lo "$SRC" >> ${CONFIG_MK}
- echo " ${LIBTOOL} --tag=CC --mode=compile \${CC} \${CPPFLAGS} \${CFLAGS_ASAN} -c $SRC -o $SRC_ASAN_LO" >> ${CONFIG_MK}
-
- if $HAVE_GCOV; then
- echo >> ${CONFIG_MK}
- SRC_COV_LO="$(c2ext .cov.lo "$SRC")"
- c_ext_rule .cov.lo "$SRC" >> ${CONFIG_MK}
- echo " ${LIBTOOL} --tag=CC --mode=compile \${CC} \${CPPFLAGS} \${CFLAGS_COV} -c $SRC -o $SRC_COV_LO" >> ${CONFIG_MK}
- fi
-
- echo >> ${CONFIG_MK}
- SRC_DEBUG_LO="$(c2ext .debug.lo "$SRC")"
- c_ext_rule .debug.lo "$SRC" >> ${CONFIG_MK}
- echo " ${LIBTOOL} --tag=CC --mode=compile \${CC} \${CPPFLAGS} \${CFLAGS_DEBUG} -c $SRC -o $SRC_DEBUG_LO" >> ${CONFIG_MK}
-done
+build_lo
+build_prog
update_config_mk
diff --git a/libc3/configure b/libc3/configure
index 00e869b..13556fb 100755
--- a/libc3/configure
+++ b/libc3/configure
@@ -110,4 +110,5 @@ update_build_lib
build_lo
build_lib
+
update_config_mk
diff --git a/libc3_window/Makefile b/libc3_window/Makefile
index fb20f6a..8156854 100644
--- a/libc3_window/Makefile
+++ b/libc3_window/Makefile
@@ -10,11 +10,6 @@
## AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
## THIS SOFTWARE.
-build:
- ${MAKE} ${LIB}
- if ${HAVE_CAIRO}; then ${MAKE} -C cairo build; fi
- if ${HAVE_SDL2}; then ${MAKE} -C sdl2 build; fi
-
all:
${MAKE} build
${MAKE} debug
@@ -26,6 +21,11 @@ asan:
if ${HAVE_CAIRO}; then ${MAKE} -C cairo asan; fi
if ${HAVE_SDL2}; then ${MAKE} -C sdl2 asan; fi
+build:
+ ${MAKE} ${LIB}
+ if ${HAVE_CAIRO}; then ${MAKE} -C cairo build; fi
+ if ${HAVE_SDL2}; then ${MAKE} -C sdl2 build; fi
+
clean:
if ${HAVE_CAIRO}; then ${MAKE} -C cairo clean; fi
if ${HAVE_SDL2}; then ${MAKE} -C sdl2 clean; fi
diff --git a/libc3_window/cairo/configure b/libc3_window/cairo/configure
index 8aff4b9..654ad3b 100755
--- a/libc3_window/cairo/configure
+++ b/libc3_window/cairo/configure
@@ -14,6 +14,7 @@
set -e
export SRC_TOP="$(dirname "$PWD")"
+CONFIG_H_PREFIX=LIBC3_WINDOW_CAIRO_
. ../../config.subr
@@ -37,8 +38,8 @@ OBJECTS_DEBUG="$(c2ext .debug.lo "$SOURCES")"
# Common config for all targets
CPPFLAGS="-I../.. $CPPFLAGS"
-CFLAGS="$CFLAGS -W -Wall -Werror -std=c11 -pedantic"
OBJCFLAGS="$CFLAGS -W -Wall -Werror"
+CFLAGS="$CFLAGS -W -Wall -Werror -std=c11 -pedantic -pipe"
LDFLAGS="--shared ${LDFLAGS}"
LIBS="$LIBS -rpath ${PREFIX}/lib"
config_asan
@@ -57,25 +58,28 @@ fi
config_define PREFIX "\"${PREFIX}\""
# Address Sanitizer config
+CPPFLAGS_ASAN="$CPPFLAGS"
CFLAGS_ASAN="$CFLAGS -O1 -fsanitize=address -fno-omit-frame-pointer -g"
LDFLAGS_ASAN="$LDFLAGS"
LIBS_LOCAL_ASAN="../libc3_window_asan.la"
LIBS_ASAN="$LIBS_LOCAL_ASAN $LIBS"
# Coverage config
+CPPFLAGS_COV="$CPPFLAGS"
CFLAGS_COV="$CFLAGS -ftest-coverage -fprofile-arcs -fprofile-generate"
LDFLAGS_COV="$LDFLAGS --coverage"
LIBS_LOCAL_COV="../libc3_window_cov.la"
LIBS_COV="$LIBS_LOCAL_COV $LIBS"
# Debug config
+CPPFLAGS_DEBUG="$CPPFLAGS"
CFLAGS_DEBUG="$CFLAGS -DDEBUG -O0 -g"
LDFLAGS_DEBUG="$LDFLAGS"
LIBS_LOCAL_DEBUG="../libc3_window_debug.la"
LIBS_DEBUG="$LIBS_LOCAL_DEBUG $LIBS"
# Main config
-DEFAULT_CFLAGS="-O2 -pipe"
+DEFAULT_CFLAGS="-O2 -fPIC"
if [ "x$ENV_CFLAGS" = "x" ]; then
CFLAGS="$CFLAGS $DEFAULT_CFLAGS"
fi
@@ -105,43 +109,11 @@ echo "CFLAGS_DEBUG = $CFLAGS_DEBUG" >> ${CONFIG_MK}
echo "LDFLAGS_DEBUG = $LDFLAGS_DEBUG" >> ${CONFIG_MK}
echo "LIBS_DEBUG = $LIBS_DEBUG" >> ${CONFIG_MK}
-echo >> ${CONFIG_MK}
-echo "$LIB: $LIBS_LOCAL $OBJECTS" >> ${CONFIG_MK}
-echo " ${LIBTOOL} --tag=CC --mode=link \${CC} -shared \${LDFLAGS} ${OBJECTS} \${LIBS} -rpath ${LIBDIR} -o ${LIB}" >> ${CONFIG_MK}
-
-echo >> ${CONFIG_MK}
-echo "$LIB_ASAN: $LIBS_LOCAL_ASAN $OBJECTS_ASAN" >> ${CONFIG_MK}
-echo " ${LIBTOOL} --tag=CC --mode=link \${CC} -shared \${LDFLAGS_ASAN} ${OBJECTS_ASAN} \${LIBS_ASAN} -rpath ${LIBDIR} -o ${LIB_ASAN}" >> ${CONFIG_MK}
+update_build
+update_build_lib
-echo >> ${CONFIG_MK}
-echo "$LIB_COV: $LIBS_LOCAL_COV $OBJECTS_COV" >> ${CONFIG_MK}
-echo " ${LIBTOOL} --tag=CC --mode=link \${CC} -shared \${LDFLAGS_COV} ${OBJECTS_COV} \${LIBS_COV} -rpath ${LIBDIR} -o ${LIB_COV}" >> ${CONFIG_MK}
-
-echo >> ${CONFIG_MK}
-echo "$LIB_DEBUG: $LIBS_LOCAL_DEBUG $OBJECTS_DEBUG" >> ${CONFIG_MK}
-echo " ${LIBTOOL} --tag=CC --mode=link \${CC} -shared \${LDFLAGS_DEBUG} ${OBJECTS_DEBUG} \${LIBS_DEBUG} -rpath ${LIBDIR} -o ${LIB_DEBUG}" >> ${CONFIG_MK}
-
-for SRC in $SOURCES; do
- echo >> ${CONFIG_MK}
- SRC_LO="$(c2ext .main.lo "$SRC")"
- c_ext_rule .main.lo "$SRC" >> ${CONFIG_MK}
- echo " ${LIBTOOL} --tag=CC --mode=compile \${CC} \${CPPFLAGS} \${CFLAGS} -c $SRC -o $SRC_LO" >> ${CONFIG_MK}
-
- echo >> ${CONFIG_MK}
- SRC_ASAN_LO="$(c2ext .asan.lo "$SRC")"
- c_ext_rule .asan.lo "$SRC" >> ${CONFIG_MK}
- echo " ${LIBTOOL} --tag=CC --mode=compile \${CC} \${CPPFLAGS} \${CFLAGS_ASAN} -c $SRC -o $SRC_ASAN_LO" >> ${CONFIG_MK}
-
- echo >> ${CONFIG_MK}
- SRC_COV_LO="$(c2ext .cov.lo "$SRC")"
- c_ext_rule .cov.lo "$SRC" >> ${CONFIG_MK}
- echo " ${LIBTOOL} --tag=CC --mode=compile \${CC} \${CPPFLAGS} \${CFLAGS_COV} -c $SRC -o $SRC_COV_LO" >> ${CONFIG_MK}
-
- echo >> ${CONFIG_MK}
- SRC_DEBUG_LO="$(c2ext .debug.lo "$SRC")"
- c_ext_rule .debug.lo "$SRC" >> ${CONFIG_MK}
- echo " ${LIBTOOL} --tag=CC --mode=compile \${CC} \${CPPFLAGS} \${CFLAGS_DEBUG} -c $SRC -o $SRC_DEBUG_LO" >> ${CONFIG_MK}
-done
+build_lo
+build_lib
if pkg-config cairo-xcb; then
HAVE_XCB=true
diff --git a/libc3_window/cairo/demo/configure b/libc3_window/cairo/demo/configure
index d16a623..4078f50 100755
--- a/libc3_window/cairo/demo/configure
+++ b/libc3_window/cairo/demo/configure
@@ -14,6 +14,7 @@
set -e
export SRC_TOP="$(dirname "$PWD")"
+CONFIG_H_PREFIX=LIBC3_WINDOW_CAIRO_DEMO_
. ../../../config.subr
@@ -37,7 +38,7 @@ OBJECTS_DEBUG="$(c2ext .debug.lo "$SOURCES")"
# Common config for all targets
CPPFLAGS="-I../../.. $CPPFLAGS"
-CFLAGS="$CFLAGS -W -Wall -Werror -std=c11 -pedantic"
+CFLAGS="$CFLAGS -W -Wall -Werror -std=c11 -pedantic -pipe"
LDFLAGS="--shared ${LDFLAGS}"
LIBS="$LIBS -rpath ${PREFIX}/lib"
config_asan
@@ -50,21 +51,31 @@ pkg_config xkbcommon
config_define PREFIX "\"${PREFIX}\""
# Address Sanitizer config
-CFLAGS_ASAN="$CFLAGS -O1 -fsanitize=address -fno-omit-frame-pointer -g"
+CPPFLAGS_ASAN="$CPPFLAGS"
+CFLAGS_ASAN="$CFLAGS -DDEBUG -O1 -g"
+CFLAGS_ASAN="$CFLAGS_ASAN -fsanitize=address -fno-omit-frame-pointer"
LDFLAGS_ASAN="$LDFLAGS"
-LIBS_LOCAL_ASAN="../libc3_window_cairo_asan.la ../../libc3_window_asan.la ../../../libc3/libc3_asan.la"
+LIBS_LOCAL_ASAN="../libc3_window_cairo_asan.la"
+LIBS_LOCAL_ASAN="$LIBS_LOCAL_ASAN ../../libc3_window_asan.la"
+LIBS_LOCAL_ASAN="$LIBS_LOCAL_ASAN ../../../libc3/libc3_asan.la"
LIBS_ASAN="$LIBS_LOCAL_ASAN $LIBS"
# Coverage config
-CFLAGS_COV="$CFLAGS -ftest-coverage -fprofile-arcs -fprofile-generate"
-LDFLAGS_COV="$LDFLAGS --coverage"
-LIBS_LOCAL_COV="../libc3_window_cairo_cov.la ../../libc3_window_cov.la ../../../libc3/libc3_cov.la"
+CPPFLAGS_COV="$CPPFLAGS"
+CFLAGS_COV="$CFLAGS -DDEBUG --coverage"
+LDFLAGS_COV="$LDFLAGS"
+LIBS_LOCAL_COV="../libc3_window_cairo_cov.la"
+LIBS_LOCAL_COV="$LIBS_LOCAL_COV ../../libc3_window_cov.la"
+LIBS_LOCAL_COV="$LIBS_LOCAL_COV ../../../libc3/libc3_cov.la"
LIBS_COV="$LIBS_LOCAL_COV $LIBS"
# Debug config
+CPPFLAGS_DEBUG="$CPPFLAGS"
CFLAGS_DEBUG="$CFLAGS -DDEBUG -O0 -g"
LDFLAGS_DEBUG="$LDFLAGS"
-LIBS_LOCAL_DEBUG="../libc3_window_cairo_debug.la ../../libc3_window_debug.la ../../../libc3/libc3_debug.la"
+LIBS_LOCAL_DEBUG="../libc3_window_cairo_debug.la"
+LIBS_LOCAL_DEBUG="$LIBS_LOCAL_DEBUG ../../libc3_window_debug.la"
+LIBS_LOCAL_DEBUG="$LIBS_LOCAL_DEBUG ../../../libc3/libc3_debug.la"
LIBS_DEBUG="$LIBS_LOCAL_DEBUG $LIBS"
# Main config
@@ -73,7 +84,9 @@ if [ "x$ENV_CFLAGS" = "x" ]; then
CFLAGS="$CFLAGS $DEFAULT_CFLAGS"
fi
CFLAGS="$CFLAGS -DNDEBUG"
-LIBS_LOCAL="../libc3_window_cairo.la ../../libc3_window.la ../../../libc3/libc3.la"
+LIBS_LOCAL="../libc3_window_cairo.la"
+LIBS_LOCAL="$LIBS_LOCAL ../../libc3_window.la"
+LIBS_LOCAL="$LIBS_LOCAL ../../../libc3/libc3.la"
LIBS="$LIBS_LOCAL $LIBS"
echo "LIB = $LIB" >> ${CONFIG_MK}
@@ -98,42 +111,10 @@ echo "CFLAGS_DEBUG = $CFLAGS_DEBUG" >> ${CONFIG_MK}
echo "LDFLAGS_DEBUG = $LDFLAGS_DEBUG" >> ${CONFIG_MK}
echo "LIBS_DEBUG = $LIBS_DEBUG" >> ${CONFIG_MK}
-echo >> ${CONFIG_MK}
-echo "$LIB: $LIBS_LOCAL $OBJECTS" >> ${CONFIG_MK}
-echo " ${LIBTOOL} --tag=CC --mode=link \${CC} -shared \${LDFLAGS} ${OBJECTS} \${LIBS} -rpath ${LIBDIR} -o ${LIB}" >> ${CONFIG_MK}
-
-echo >> ${CONFIG_MK}
-echo "$LIB_ASAN: $LIBS_LOCAL_ASAN $OBJECTS_ASAN" >> ${CONFIG_MK}
-echo " ${LIBTOOL} --tag=CC --mode=link \${CC} -shared \${LDFLAGS_ASAN} ${OBJECTS_ASAN} \${LIBS_ASAN} -rpath ${LIBDIR} -o ${LIB_ASAN}" >> ${CONFIG_MK}
+update_build
+update_build_lib
-echo >> ${CONFIG_MK}
-echo "$LIB_COV: $LIBS_LOCAL_COV $OBJECTS_COV" >> ${CONFIG_MK}
-echo " ${LIBTOOL} --tag=CC --mode=link \${CC} -shared \${LDFLAGS_COV} ${OBJECTS_COV} \${LIBS_COV} -rpath ${LIBDIR} -o ${LIB_COV}" >> ${CONFIG_MK}
-
-echo >> ${CONFIG_MK}
-echo "$LIB_DEBUG: $LIBS_LOCAL_DEBUG $OBJECTS_DEBUG" >> ${CONFIG_MK}
-echo " ${LIBTOOL} --tag=CC --mode=link \${CC} -shared \${LDFLAGS_DEBUG} ${OBJECTS_DEBUG} \${LIBS_DEBUG} -rpath ${LIBDIR} -o ${LIB_DEBUG}" >> ${CONFIG_MK}
-
-for SRC in $SOURCES; do
- echo >> ${CONFIG_MK}
- SRC_LO="$(c2ext .main.lo "$SRC")"
- c_ext_rule .main.lo "$SRC" >> ${CONFIG_MK}
- echo " ${LIBTOOL} --tag=CC --mode=compile \${CC} \${CPPFLAGS} \${CFLAGS} -c $SRC -o $SRC_LO" >> ${CONFIG_MK}
-
- echo >> ${CONFIG_MK}
- SRC_ASAN_LO="$(c2ext .asan.lo "$SRC")"
- c_ext_rule .asan.lo "$SRC" >> ${CONFIG_MK}
- echo " ${LIBTOOL} --tag=CC --mode=compile \${CC} \${CPPFLAGS} \${CFLAGS_ASAN} -c $SRC -o $SRC_ASAN_LO" >> ${CONFIG_MK}
-
- echo >> ${CONFIG_MK}
- SRC_COV_LO="$(c2ext .cov.lo "$SRC")"
- c_ext_rule .cov.lo "$SRC" >> ${CONFIG_MK}
- echo " ${LIBTOOL} --tag=CC --mode=compile \${CC} \${CPPFLAGS} \${CFLAGS_COV} -c $SRC -o $SRC_COV_LO" >> ${CONFIG_MK}
-
- echo >> ${CONFIG_MK}
- SRC_DEBUG_LO="$(c2ext .debug.lo "$SRC")"
- c_ext_rule .debug.lo "$SRC" >> ${CONFIG_MK}
- echo " ${LIBTOOL} --tag=CC --mode=compile \${CC} \${CPPFLAGS} \${CFLAGS_DEBUG} -c $SRC -o $SRC_DEBUG_LO" >> ${CONFIG_MK}
-done
+build_lo
+build_lib
update_config_mk
diff --git a/libc3_window/cairo/xcb/configure b/libc3_window/cairo/xcb/configure
index e966030..12f1fdc 100755
--- a/libc3_window/cairo/xcb/configure
+++ b/libc3_window/cairo/xcb/configure
@@ -14,6 +14,7 @@
set -e
export SRC_TOP="$(dirname "$PWD")"
+CONFIG_H_PREFIX=LIBC3_WINDOW_CAIRO_XCB_
. ../../../config.subr
@@ -37,9 +38,8 @@ OBJECTS_DEBUG="$(c2ext .debug.lo "$SOURCES")"
# Common config for all targets
CPPFLAGS="$CPPFLAGS -I../../.."
-CFLAGS="$CFLAGS -W -Wall -Werror -std=c11 -pedantic -fPIC"
+CFLAGS="$CFLAGS -W -Wall -Werror -std=c11 -pedantic -pipe"
LDFLAGS="--shared ${LDFLAGS}"
-LIBS="$LIBS -rpath ${PREFIX}/lib"
config_asan
config_gnu
pkg_config libbsd-overlay
@@ -52,27 +52,32 @@ pkg_config cairo-xcb
config_define PREFIX "\"${PREFIX}\""
update_config_h
LIBS="$LIBS -lxkbcommon -lxkbcommon-x11"
+LIBS="$LIBS -rpath ${PREFIX}/lib"
# Address Sanitizer config
-CFLAGS_ASAN="$CFLAGS -O1 -fsanitize=address -fno-omit-frame-pointer -g"
+CPPFLAGS_ASAN="$CPPFLAGS"
+CFLAGS_ASAN="$CFLAGS -DDEBUG -O1 -g"
+CFLAGS_ASAN="$CFLAGS_ASAN -fsanitize=address -fno-omit-frame-pointer"
LDFLAGS_ASAN="$LDFLAGS"
LIBS_LOCAL_ASAN="../libc3_window_cairo_asan.la"
LIBS_ASAN="$LIBS_LOCAL_ASAN $LIBS"
# Coverage config
-CFLAGS_COV="$CFLAGS -ftest-coverage -fprofile-arcs -fprofile-generate"
-LDFLAGS_COV="$LDFLAGS --coverage"
+CPPFLAGS_COV="$CPPFLAGS"
+CFLAGS_COV="$CFLAGS -DDEBUG --coverage"
+LDFLAGS_COV="$LDFLAGS"
LIBS_LOCAL_COV="../libc3_window_cairo_cov.la"
LIBS_COV="$LIBS_LOCAL_COV $LIBS"
# Debug config
+CPPFLAGS_DEBUG="$CPPFLAGS"
CFLAGS_DEBUG="$CFLAGS -DDEBUG -O0 -g"
LDFLAGS_DEBUG="$LDFLAGS"
LIBS_LOCAL_DEBUG="../libc3_window_cairo_debug.la"
LIBS_DEBUG="$LIBS_LOCAL_DEBUG $LIBS"
# Main config
-DEFAULT_CFLAGS="-O2 -pipe"
+DEFAULT_CFLAGS="-O2 -fPIC"
if [ "x$ENV_CFLAGS" = "x" ]; then
CFLAGS="$CFLAGS $DEFAULT_CFLAGS"
fi
@@ -102,43 +107,11 @@ echo "CFLAGS_DEBUG = $CFLAGS_DEBUG" >> ${CONFIG_MK}
echo "LDFLAGS_DEBUG = $LDFLAGS_DEBUG" >> ${CONFIG_MK}
echo "LIBS_DEBUG = $LIBS_DEBUG" >> ${CONFIG_MK}
-echo >> ${CONFIG_MK}
-echo "$LIB: $LIBS_LOCAL $OBJECTS" >> ${CONFIG_MK}
-echo " ${LIBTOOL} --tag=CC --mode=link \${CC} -shared \${LDFLAGS} ${OBJECTS} \${LIBS} -rpath ${LIBDIR} -o ${LIB}" >> ${CONFIG_MK}
-
-echo >> ${CONFIG_MK}
-echo "$LIB_ASAN: $LIBS_LOCAL_ASAN $OBJECTS_ASAN" >> ${CONFIG_MK}
-echo " ${LIBTOOL} --tag=CC --mode=link \${CC} -shared \${LDFLAGS_ASAN} ${OBJECTS_ASAN} \${LIBS_ASAN} -rpath ${LIBDIR} -o ${LIB_ASAN}" >> ${CONFIG_MK}
-
-echo >> ${CONFIG_MK}
-echo "$LIB_COV: $LIBS_LOCAL_COV $OBJECTS_COV" >> ${CONFIG_MK}
-echo " ${LIBTOOL} --tag=CC --mode=link \${CC} -shared \${LDFLAGS_COV} ${OBJECTS_COV} \${LIBS_COV} -rpath ${LIBDIR} -o ${LIB_COV}" >> ${CONFIG_MK}
+update_build
+update_build_lib
-echo >> ${CONFIG_MK}
-echo "$LIB_DEBUG: $LIBS_LOCAL_DEBUG $OBJECTS_DEBUG" >> ${CONFIG_MK}
-echo " ${LIBTOOL} --tag=CC --mode=link \${CC} -shared \${LDFLAGS_DEBUG} ${OBJECTS_DEBUG} \${LIBS_DEBUG} -rpath ${LIBDIR} -o ${LIB_DEBUG}" >> ${CONFIG_MK}
-
-for SRC in $SOURCES; do
- echo >> ${CONFIG_MK}
- SRC_LO="$(c2ext .main.lo "$SRC")"
- c_ext_rule .main.lo "$SRC" >> ${CONFIG_MK}
- echo " ${LIBTOOL} --tag=CC --mode=compile \${CC} \${CPPFLAGS} \${CFLAGS} -c $SRC -o $SRC_LO" >> ${CONFIG_MK}
-
- echo >> ${CONFIG_MK}
- SRC_ASAN_LO="$(c2ext .asan.lo "$SRC")"
- c_ext_rule .asan.lo "$SRC" >> ${CONFIG_MK}
- echo " ${LIBTOOL} --tag=CC --mode=compile \${CC} \${CPPFLAGS} \${CFLAGS_ASAN} -c $SRC -o $SRC_ASAN_LO" >> ${CONFIG_MK}
-
- echo >> ${CONFIG_MK}
- SRC_COV_LO="$(c2ext .cov.lo "$SRC")"
- c_ext_rule .cov.lo "$SRC" >> ${CONFIG_MK}
- echo " ${LIBTOOL} --tag=CC --mode=compile \${CC} \${CPPFLAGS} \${CFLAGS_COV} -c $SRC -o $SRC_COV_LO" >> ${CONFIG_MK}
-
- echo >> ${CONFIG_MK}
- SRC_DEBUG_LO="$(c2ext .debug.lo "$SRC")"
- c_ext_rule .debug.lo "$SRC" >> ${CONFIG_MK}
- echo " ${LIBTOOL} --tag=CC --mode=compile \${CC} \${CPPFLAGS} \${CFLAGS_DEBUG} -c $SRC -o $SRC_DEBUG_LO" >> ${CONFIG_MK}
-done
+build_lo
+build_lib
update_config_mk
env_reset
diff --git a/libc3_window/cairo/xcb/demo/configure b/libc3_window/cairo/xcb/demo/configure
index cf3c05c..bdc7074 100755
--- a/libc3_window/cairo/xcb/demo/configure
+++ b/libc3_window/cairo/xcb/demo/configure
@@ -56,21 +56,37 @@ pkg_config cairo
LIBS="$LIBS"
# Asan config
-CFLAGS_ASAN="$CFLAGS -fsanitize=address -O1 -fno-omit-frame-pointer -g"
+CPPFLAGS_ASAN="$CPPFLAGS"
+CFLAGS_ASAN="$CFLAGS -DDEBUG -O1 -g"
+CFLAGS_ASAN="$CFLAGS_ASAN -fsanitize=address -fno-omit-frame-pointer"
LDFLAGS_ASAN="$LDFLAGS"
-LOCAL_LIBS_ASAN="../../../../libc3/libc3_asan.la ../../../libc3_window_asan.la ../../libc3_window_cairo_asan.la ../../demo/libc3_window_cairo_demo_asan.la ../libc3_window_cairo_xcb_asan.la"
+LOCAL_LIBS_ASAN="../../../../libc3/libc3_asan.la"
+LOCAL_LIBS_ASAN="$LOCAL_LIBS_ASAN ../../../libc3_window_asan.la"
+LOCAL_LIBS_ASAN="$LOCAL_LIBS_ASAN ../../libc3_window_cairo_asan.la"
+LOCAL_LIBS_ASAN="$LOCAL_LIBS_ASAN ../../demo/libc3_window_cairo_demo_asan.la"
+LOCAL_LIBS_ASAN="$LOCAL_LIBS_ASAN ../libc3_window_cairo_xcb_asan.la"
LIBS_ASAN="$LOCAL_LIBS_ASAN $LIBS"
# Coverage config
-CFLAGS_COV="$CFLAGS -ftest-coverage -fprofile-arcs -fprofile-generate"
-LDFLAGS_COV="$LDFLAGS --coverage"
-LOCAL_LIBS_COV="../../../../libc3/libc3_cov.la ../../../libc3_window_cov.la ../../libc3_window_cairo_cov.la ../../demo/libc3_window_cairo_demo_cov.la ../libc3_window_cairo_xcb_cov.la"
+CPPFLAGS_COV="$CPPFLAGS"
+CFLAGS_COV="$CFLAGS -DDEBUG --coverage"
+LDFLAGS_COV="$LDFLAGS"
+LOCAL_LIBS_COV="../../../../libc3/libc3_cov.la"
+LOCAL_LIBS_COV="$LOCAL_LIBS_COV ../../../libc3_window_cov.la"
+LOCAL_LIBS_COV="$LOCAL_LIBS_COV ../../libc3_window_cairo_cov.la"
+LOCAL_LIBS_COV="$LOCAL_LIBS_COV ../../demo/libc3_window_cairo_demo_cov.la"
+LOCAL_LIBS_COV="$LOCAL_LIBS_COV ../libc3_window_cairo_xcb_cov.la"
LIBS_COV="$LOCAL_LIBS_COV $LIBS"
# Debug config
+CPPFLAGS_DEBUG="$CPPFLAGS"
CFLAGS_DEBUG="$CFLAGS -DDEBUG -O0 -g"
LDFLAGS_DEBUG="$LDFLAGS"
-LOCAL_LIBS_DEBUG="../../../../libc3/libc3_debug.la ../../../libc3_window_debug.la ../../libc3_window_cairo_debug.la ../../demo/libc3_window_cairo_demo_debug.la ../libc3_window_cairo_xcb_debug.la"
+LOCAL_LIBS_DEBUG="../../../../libc3/libc3_debug.la"
+LOCAL_LIBS_DEBUG="$LOCAL_LIBS_DEBUG ../../../libc3_window_debug.la"
+LOCAL_LIBS_DEBUG="$LOCAL_LIBS_DEBUG ../../libc3_window_cairo_debug.la"
+LOCAL_LIBS_DEBUG="$LOCAL_LIBS_DEBUG ../../demo/libc3_window_cairo_demo_debug.la"
+LOCAL_LIBS_DEBUG="$LOCAL_LIBS_DEBUG ../libc3_window_cairo_xcb_debug.la"
LIBS_DEBUG="$LOCAL_LIBS_DEBUG $LIBS"
# Main config
@@ -79,7 +95,11 @@ if [ "x$ENV_CFLAGS" = "x" ]; then
CFLAGS="$CFLAGS $DEFAULT_CFLAGS"
fi
CFLAGS="$CFLAGS -DNDEBUG"
-LOCAL_LIBS="../../../../libc3/libc3.la ../../../libc3_window.la ../../libc3_window_cairo.la ../../demo/libc3_window_cairo_demo.la ../libc3_window_cairo_xcb.la"
+LOCAL_LIBS="../../../../libc3/libc3.la"
+LOCAL_LIBS="$LOCAL_LIBS ../../../libc3_window.la"
+LOCAL_LIBS="$LOCAL_LIBS ../../libc3_window_cairo.la"
+LOCAL_LIBS="$LOCAL_LIBS ../../demo/libc3_window_cairo_demo.la"
+LOCAL_LIBS="$LOCAL_LIBS ../libc3_window_cairo_xcb.la"
LIBS="$LOCAL_LIBS $LIBS"
echo "HAVE_ASAN = $HAVE_ASAN" >> ${CONFIG_MK}
@@ -100,46 +120,10 @@ echo "CFLAGS_DEBUG = $CFLAGS_DEBUG" >> ${CONFIG_MK}
echo "LDFLAGS_DEBUG = $LDFLAGS_DEBUG" >> ${CONFIG_MK}
echo "LIBS_DEBUG = $LIBS_DEBUG" >> ${CONFIG_MK}
-echo >> ${CONFIG_MK}
-echo "$PROG: $LOCAL_LIBS $OBJECTS" >> ${CONFIG_MK}
-echo " ${LIBTOOL} --tag=CC --mode=link \${CC} \${CFLAGS} \${LDFLAGS} ${OBJECTS} ${LIBS} -o $PROG" >> ${CONFIG_MK}
-
-echo >> ${CONFIG_MK}
-echo "$PROG_ASAN: $LOCAL_LIBS_ASAN $OBJECTS_ASAN" >> ${CONFIG_MK}
-echo " ${LIBTOOL} --tag=CC --mode=link \${CC} \${CFLAGS_ASAN} \${LDFLAGS_ASAN} ${OBJECTS_ASAN} ${LIBS_ASAN} -o $PROG_ASAN" >> ${CONFIG_MK}
+update_build
+update_build_prog
-if $HAVE_GCOV; then
- echo >> ${CONFIG_MK}
- echo "$PROG_COV: $LOCAL_LIBS_COV $OBJECTS_COV" >> ${CONFIG_MK}
- echo " ${LIBTOOL} --tag=CC --mode=link \${CC} \${CFLAGS_COV} \${LDFLAGS_COV} ${OBJECTS_COV} ${LIBS_COV} -o $PROG_COV" >> ${CONFIG_MK}
-fi
-
-echo >> ${CONFIG_MK}
-echo "$PROG_DEBUG: $LOCAL_LIBS_DEBUG $OBJECTS_DEBUG" >> ${CONFIG_MK}
-echo " ${LIBTOOL} --tag=CC --mode=link \${CC} \${CFLAGS_DEBUG} \${LDFLAGS_DEBUG} ${OBJECTS_DEBUG} ${LIBS_DEBUG} -o $PROG_DEBUG" >> ${CONFIG_MK}
-
-for SRC in $SOURCES; do
- echo >> ${CONFIG_MK}
- SRC_LO="$(c2ext .main.lo "$SRC")"
- c_ext_rule .main.lo "$SRC" >> ${CONFIG_MK}
- echo " ${LIBTOOL} --tag=CC --mode=compile \${CC} \${CPPFLAGS} \${CFLAGS} -c $SRC -o $SRC_LO" >> ${CONFIG_MK}
-
- echo >> ${CONFIG_MK}
- SRC_ASAN_LO="$(c2ext .asan.lo "$SRC")"
- c_ext_rule .asan.lo "$SRC" >> ${CONFIG_MK}
- echo " ${LIBTOOL} --tag=CC --mode=compile \${CC} \${CPPFLAGS} \${CFLAGS_ASAN} -c $SRC -o $SRC_ASAN_LO" >> ${CONFIG_MK}
-
- if $HAVE_GCOV; then
- echo >> ${CONFIG_MK}
- SRC_COV_LO="$(c2ext .cov.lo "$SRC")"
- c_ext_rule .cov.lo "$SRC" >> ${CONFIG_MK}
- echo " ${LIBTOOL} --tag=CC --mode=compile \${CC} \${CPPFLAGS} \${CFLAGS_COV} -c $SRC -o $SRC_COV_LO" >> ${CONFIG_MK}
- fi
-
- echo >> ${CONFIG_MK}
- SRC_DEBUG_LO="$(c2ext .debug.lo "$SRC")"
- c_ext_rule .debug.lo "$SRC" >> ${CONFIG_MK}
- echo " ${LIBTOOL} --tag=CC --mode=compile \${CC} \${CPPFLAGS} \${CFLAGS_DEBUG} -c $SRC -o $SRC_DEBUG_LO" >> ${CONFIG_MK}
-done
+build_lo
+build_prog
update_config_mk
diff --git a/libc3_window/configure b/libc3_window/configure
index 5dd646a..71d1b76 100755
--- a/libc3_window/configure
+++ b/libc3_window/configure
@@ -14,6 +14,7 @@
set -e
export SRC_TOP="$(dirname "$PWD")"
+CONFIG_H_PREFIX=LIBC3_WINDOW_
. ../config.subr
@@ -37,36 +38,40 @@ OBJECTS_DEBUG="$(c2ext .debug.lo "$SOURCES")"
# Common config for all targets
CPPFLAGS="-I.. $CPPFLAGS"
-CFLAGS="$CFLAGS -W -Wall -Werror -std=c11 -pedantic"
-LDFLAGS="--shared ${LDFLAGS}"
-LIBS="$LIBS -rpath ${PREFIX}/lib"
+CFLAGS="$CFLAGS -W -Wall -Werror -std=c11 -pedantic -pipe"
+LDFLAGS="--shared ${LDFLAGS} -rdynamic"
config_asan
config_gnu
pkg_config libbsd-overlay
pkg_config libffi
pkg_config libmd
config_define PREFIX "\"${PREFIX}\""
+LIBS="$LIBS -rpath ${PREFIX}/lib"
# Address Sanitizer config
-CFLAGS_ASAN="$CFLAGS -O1 -fsanitize=address -fno-omit-frame-pointer -g"
+CPPFLAGS_ASAN="$CPPFLAGS"
+CFLAGS_ASAN="$CFLAGS -DDEBUG -O1 -g"
+CFLAGS_ASAN="$CFLAGS_ASAN -fsanitize=address -fno-omit-frame-pointer"
LDFLAGS_ASAN="$LDFLAGS"
LIBS_LOCAL_ASAN="../libc3/libc3_asan.la"
LIBS_ASAN="$LIBS_LOCAL_ASAN $LIBS"
# Coverage config
-CFLAGS_COV="$CFLAGS -ftest-coverage -fprofile-arcs -fprofile-generate"
-LDFLAGS_COV="$LDFLAGS --coverage"
+CPPFLAGS_COV="$CPPFLAGS"
+CFLAGS_COV="$CFLAGS --coverage"
+LDFLAGS_COV="$LDFLAGS"
LIBS_LOCAL_COV="../libc3/libc3_cov.la"
LIBS_COV="$LIBS_LOCAL_COV $LIBS"
# Debug config
+CPPFLAGS_DEBUG="$CPPFLAGS"
CFLAGS_DEBUG="$CFLAGS -DDEBUG -O0 -g"
LDFLAGS_DEBUG="$LDFLAGS"
LIBS_LOCAL_DEBUG="../libc3/libc3_debug.la"
LIBS_DEBUG="$LIBS_LOCAL_DEBUG $LIBS"
# Main config
-DEFAULT_CFLAGS="-O2 -pipe"
+DEFAULT_CFLAGS="-O2 -pipe -fPIC"
if [ "x$ENV_CFLAGS" = "x" ]; then
CFLAGS="$CFLAGS $DEFAULT_CFLAGS"
fi
@@ -96,43 +101,11 @@ echo "CFLAGS_DEBUG = $CFLAGS_DEBUG" >> ${CONFIG_MK}
echo "LDFLAGS_DEBUG = $LDFLAGS_DEBUG" >> ${CONFIG_MK}
echo "LIBS_DEBUG = $LIBS_DEBUG" >> ${CONFIG_MK}
-echo >> ${CONFIG_MK}
-echo "$LIB: $LIBS_LOCAL $OBJECTS" >> ${CONFIG_MK}
-echo " ${LIBTOOL} --tag=CC --mode=link \${CC} -shared \${LDFLAGS} ${OBJECTS} \${LIBS} -rpath ${LIBDIR} -o ${LIB}" >> ${CONFIG_MK}
-
-echo >> ${CONFIG_MK}
-echo "$LIB_ASAN: $LIBS_LOCAL_ASAN $OBJECTS_ASAN" >> ${CONFIG_MK}
-echo " ${LIBTOOL} --tag=CC --mode=link \${CC} -shared \${LDFLAGS_ASAN} ${OBJECTS_ASAN} \${LIBS_ASAN} -rpath ${LIBDIR} -o ${LIB_ASAN}" >> ${CONFIG_MK}
-
-echo >> ${CONFIG_MK}
-echo "$LIB_COV: $LIBS_LOCAL_COV $OBJECTS_COV" >> ${CONFIG_MK}
-echo " ${LIBTOOL} --tag=CC --mode=link \${CC} -shared \${LDFLAGS_COV} ${OBJECTS_COV} \${LIBS_COV} -rpath ${LIBDIR} -o ${LIB_COV}" >> ${CONFIG_MK}
+update_build
+update_build_lib
-echo >> ${CONFIG_MK}
-echo "$LIB_DEBUG: $LIBS_LOCAL_DEBUG $OBJECTS_DEBUG" >> ${CONFIG_MK}
-echo " ${LIBTOOL} --tag=CC --mode=link \${CC} -shared \${LDFLAGS_DEBUG} ${OBJECTS_DEBUG} \${LIBS_DEBUG} -rpath ${LIBDIR} -o ${LIB_DEBUG}" >> ${CONFIG_MK}
-
-for SRC in $SOURCES; do
- echo >> ${CONFIG_MK}
- SRC_LO="$(c2ext .main.lo "$SRC")"
- c_ext_rule .main.lo "$SRC" >> ${CONFIG_MK}
- echo " ${LIBTOOL} --tag=CC --mode=compile \${CC} \${CPPFLAGS} \${CFLAGS} -c $SRC -o $SRC_LO" >> ${CONFIG_MK}
-
- echo >> ${CONFIG_MK}
- SRC_ASAN_LO="$(c2ext .asan.lo "$SRC")"
- c_ext_rule .asan.lo "$SRC" >> ${CONFIG_MK}
- echo " ${LIBTOOL} --tag=CC --mode=compile \${CC} \${CPPFLAGS} \${CFLAGS_ASAN} -c $SRC -o $SRC_ASAN_LO" >> ${CONFIG_MK}
-
- echo >> ${CONFIG_MK}
- SRC_COV_LO="$(c2ext .cov.lo "$SRC")"
- c_ext_rule .cov.lo "$SRC" >> ${CONFIG_MK}
- echo " ${LIBTOOL} --tag=CC --mode=compile \${CC} \${CPPFLAGS} \${CFLAGS_COV} -c $SRC -o $SRC_COV_LO" >> ${CONFIG_MK}
-
- echo >> ${CONFIG_MK}
- SRC_DEBUG_LO="$(c2ext .debug.lo "$SRC")"
- c_ext_rule .debug.lo "$SRC" >> ${CONFIG_MK}
- echo " ${LIBTOOL} --tag=CC --mode=compile \${CC} \${CPPFLAGS} \${CFLAGS_DEBUG} -c $SRC -o $SRC_DEBUG_LO" >> ${CONFIG_MK}
-done
+build_lo
+build_lib
if pkg-config cairo; then
HAVE_CAIRO=true
diff --git a/libc3_window/sdl2/configure b/libc3_window/sdl2/configure
index 272181b..63ece62 100755
--- a/libc3_window/sdl2/configure
+++ b/libc3_window/sdl2/configure
@@ -38,9 +38,8 @@ OBJECTS_DEBUG="$(c2ext .debug.lo "$SOURCES")"
# Common config for all targets
CPPFLAGS="-I../.. $CPPFLAGS"
#CPPFLAGS="$CPPFLAGS -DGL_SILENCE_DEPRECATION=1"
-CFLAGS="$CFLAGS -W -Wall -Werror -std=c11 -pedantic"
+CFLAGS="$CFLAGS -W -Wall -Werror -std=c11 -pedantic -pipe"
LDFLAGS="--shared ${LDFLAGS}"
-LIBS="$LIBS -rpath ${PREFIX}/lib"
config_asan
config_gnu
pkg_config libbsd-overlay
@@ -55,27 +54,32 @@ pkg_config libpng
config_lib OPENGL -framework OpenGL
pkg_config sdl2
config_define PREFIX "\"${PREFIX}\""
+LIBS="$LIBS -rpath ${PREFIX}/lib"
# Address Sanitizer config
-CFLAGS_ASAN="$CFLAGS -O1 -fsanitize=address -fno-omit-frame-pointer -g"
+CPPFLAGS_ASAN="$CPPFLAGS"
+CFLAGS_ASAN="$CFLAGS -DDEBUG -O1 -g"
+CFLAGS_ASAN="$CFLAGS_ASAN -fsanitize=address -fno-omit-frame-pointer"
LDFLAGS_ASAN="$LDFLAGS"
LIBS_LOCAL_ASAN="../libc3_window_asan.la"
LIBS_ASAN="$LIBS_LOCAL_ASAN $LIBS"
# Coverage config
-CFLAGS_COV="$CFLAGS -ftest-coverage -fprofile-arcs -fprofile-generate"
-LDFLAGS_COV="$LDFLAGS --coverage"
+CPPFLAGS_COV="$CPPFLAGS"
+CFLAGS_COV="$CFLAGS -DDEBUG --coverage"
+LDFLAGS_COV="$LDFLAGS"
LIBS_LOCAL_COV="../libc3_window_cov.la"
LIBS_COV="$LIBS_LOCAL_COV $LIBS"
# Debug config
+CPPFLAGS_DEBUG="$CPPFLAGS"
CFLAGS_DEBUG="$CFLAGS -DDEBUG -O0 -g"
LDFLAGS_DEBUG="$LDFLAGS"
LIBS_LOCAL_DEBUG="../libc3_window_debug.la"
LIBS_DEBUG="$LIBS_LOCAL_DEBUG $LIBS"
# Main config
-DEFAULT_CFLAGS="-O2 -pipe"
+DEFAULT_CFLAGS="-O2 -fPIC"
if [ "x$ENV_CFLAGS" = "x" ]; then
CFLAGS="$CFLAGS $DEFAULT_CFLAGS"
fi
@@ -105,43 +109,11 @@ echo "CFLAGS_DEBUG = $CFLAGS_DEBUG" >> ${CONFIG_MK}
echo "LDFLAGS_DEBUG = $LDFLAGS_DEBUG" >> ${CONFIG_MK}
echo "LIBS_DEBUG = $LIBS_DEBUG" >> ${CONFIG_MK}
-echo >> ${CONFIG_MK}
-echo "$LIB: $LIBS_LOCAL $OBJECTS" >> ${CONFIG_MK}
-echo " ${LIBTOOL} --tag=CC --mode=link \${CC} -shared \${LDFLAGS} ${OBJECTS} \${LIBS} -rpath ${LIBDIR} -o ${LIB}" >> ${CONFIG_MK}
-
-echo >> ${CONFIG_MK}
-echo "$LIB_ASAN: $LIBS_LOCAL_ASAN $OBJECTS_ASAN" >> ${CONFIG_MK}
-echo " ${LIBTOOL} --tag=CC --mode=link \${CC} -shared \${LDFLAGS_ASAN} ${OBJECTS_ASAN} \${LIBS_ASAN} -rpath ${LIBDIR} -o ${LIB_ASAN}" >> ${CONFIG_MK}
-
-echo >> ${CONFIG_MK}
-echo "$LIB_COV: $LIBS_LOCAL_COV $OBJECTS_COV" >> ${CONFIG_MK}
-echo " ${LIBTOOL} --tag=CC --mode=link \${CC} -shared \${LDFLAGS_COV} ${OBJECTS_COV} \${LIBS_COV} -rpath ${LIBDIR} -o ${LIB_COV}" >> ${CONFIG_MK}
+update_build
+update_build_lib
-echo >> ${CONFIG_MK}
-echo "$LIB_DEBUG: $LIBS_LOCAL_DEBUG $OBJECTS_DEBUG" >> ${CONFIG_MK}
-echo " ${LIBTOOL} --tag=CC --mode=link \${CC} -shared \${LDFLAGS_DEBUG} ${OBJECTS_DEBUG} \${LIBS_DEBUG} -rpath ${LIBDIR} -o ${LIB_DEBUG}" >> ${CONFIG_MK}
-
-for SRC in $SOURCES; do
- echo >> ${CONFIG_MK}
- SRC_LO="$(c2ext .main.lo "$SRC")"
- c_ext_rule .main.lo "$SRC" >> ${CONFIG_MK}
- echo " ${LIBTOOL} --tag=CC --mode=compile \${CC} \${CPPFLAGS} \${CFLAGS} -c $SRC -o $SRC_LO" >> ${CONFIG_MK}
-
- echo >> ${CONFIG_MK}
- SRC_ASAN_LO="$(c2ext .asan.lo "$SRC")"
- c_ext_rule .asan.lo "$SRC" >> ${CONFIG_MK}
- echo " ${LIBTOOL} --tag=CC --mode=compile \${CC} \${CPPFLAGS} \${CFLAGS_ASAN} -c $SRC -o $SRC_ASAN_LO" >> ${CONFIG_MK}
-
- echo >> ${CONFIG_MK}
- SRC_COV_LO="$(c2ext .cov.lo "$SRC")"
- c_ext_rule .cov.lo "$SRC" >> ${CONFIG_MK}
- echo " ${LIBTOOL} --tag=CC --mode=compile \${CC} \${CPPFLAGS} \${CFLAGS_COV} -c $SRC -o $SRC_COV_LO" >> ${CONFIG_MK}
-
- echo >> ${CONFIG_MK}
- SRC_DEBUG_LO="$(c2ext .debug.lo "$SRC")"
- c_ext_rule .debug.lo "$SRC" >> ${CONFIG_MK}
- echo " ${LIBTOOL} --tag=CC --mode=compile \${CC} \${CPPFLAGS} \${CFLAGS_DEBUG} -c $SRC -o $SRC_DEBUG_LO" >> ${CONFIG_MK}
-done
+build_lo
+build_lib
update_config_mk
env_reset
diff --git a/libc3_window/sdl2/demo/configure b/libc3_window/sdl2/demo/configure
index 681d5a2..a9cd9bc 100755
--- a/libc3_window/sdl2/demo/configure
+++ b/libc3_window/sdl2/demo/configure
@@ -46,7 +46,7 @@ echo "OBJECTS_DEBUG = $OBJECTS_DEBUG" >> ${CONFIG_MK}
# Common config for all targets
CPPFLAGS="-fopenmp -I../../.. $CPPFLAGS"
#CPPFLAGS="$CPPFLAGS -DGL_SILENCE_DEPRECATION=1"
-CFLAGS="$CFLAGS -W -Wall -Werror -std=c11 -pedantic"
+CFLAGS="$CFLAGS -W -Wall -Werror -std=c11 -pedantic -pipe"
LIBS="$LIBS -lm -fopenmp"
config_asan
config_gnu
@@ -64,30 +64,42 @@ config_lib OPENGL -lopengl32 -lglu32
pkg_config sdl2
# Asan config
-CFLAGS_ASAN="$CFLAGS -fsanitize=address -O1 -fno-omit-frame-pointer -g"
+CPPFLAGS_ASAN="$CPPFLAGS"
+CFLAGS_ASAN="$CFLAGS -DDEBUG -O1 -g"
+CFLAGS_ASAN="$CFLAGS_ASAN -fsanitize=address -fno-omit-frame-pointer"
LDFLAGS_ASAN="$LDFLAGS"
-LOCAL_LIBS_ASAN="../../../libc3/libc3_asan.la ../../libc3_window_asan.la ../libc3_window_sdl2_asan.la"
+LOCAL_LIBS_ASAN="../../../libc3/libc3_asan.la"
+LOCAL_LIBS_ASAN="$LOCAL_LIBS_ASAN ../../libc3_window_asan.la"
+LOCAL_LIBS_ASAN="$LOCAL_LIBS_ASAN ../libc3_window_sdl2_asan.la"
LIBS_ASAN="$LOCAL_LIBS_ASAN $LIBS"
# Coverage config
-CFLAGS_COV="$CFLAGS -ftest-coverage -fprofile-arcs -fprofile-generate"
-LDFLAGS_COV="$LDFLAGS --coverage"
-LOCAL_LIBS_COV="../../../libc3/libc3_cov.la ../../libc3_window_cov.la ../libc3_window_sdl2_cov.la"
+CPPFLAGS_COV="$CPPFLAGS"
+CFLAGS_COV="$CFLAGS -DDEBUG --coverage"
+LDFLAGS_COV="$LDFLAGS"
+LOCAL_LIBS_COV="../../../libc3/libc3_cov.la"
+LOCAL_LIBS_COV="$LOCAL_LIBS_COV ../../libc3_window_cov.la"
+LOCAL_LIBS_COV="$LOCAL_LIBS_COV ../libc3_window_sdl2_cov.la"
LIBS_COV="$LOCAL_LIBS_COV $LIBS"
# Debug config
+CPPFLAGS_DEBUG="$CPPFLAGS"
CFLAGS_DEBUG="$CFLAGS -DDEBUG -O0 -g"
LDFLAGS_DEBUG="$LDFLAGS"
-LOCAL_LIBS_DEBUG="../../../libc3/libc3_debug.la ../../libc3_window_debug.la ../libc3_window_sdl2_debug.la"
+LOCAL_LIBS_DEBUG="../../../libc3/libc3_debug.la"
+LOCAL_LIBS_DEBUG="$LOCAL_LIBS_DEBUG ../../libc3_window_debug.la"
+LOCAL_LIBS_DEBUG="$LOCAL_LIBS_DEBUG ../libc3_window_sdl2_debug.la"
LIBS_DEBUG="$LOCAL_LIBS_DEBUG $LIBS"
# Main config
-DEFAULT_CFLAGS="-O2 -pipe"
+DEFAULT_CFLAGS="-O2 -fPIC"
if [ "x$ENV_CFLAGS" = "x" ]; then
CFLAGS="$CFLAGS $DEFAULT_CFLAGS"
fi
CFLAGS="$CFLAGS -DNDEBUG"
-LOCAL_LIBS="../../../libc3/libc3.la ../../libc3_window.la ../libc3_window_sdl2.la"
+LOCAL_LIBS="../../../libc3/libc3.la"
+LOCAL_LIBS="$LOCAL_LIBS ../../libc3_window.la"
+LOCAL_LIBS="$LOCAL_LIBS ../libc3_window_sdl2.la"
LIBS="$LOCAL_LIBS $LIBS"
echo "HAVE_ASAN = $HAVE_ASAN" >> ${CONFIG_MK}
@@ -108,49 +120,11 @@ echo "CFLAGS_DEBUG = $CFLAGS_DEBUG" >> ${CONFIG_MK}
echo "LDFLAGS_DEBUG = $LDFLAGS_DEBUG" >> ${CONFIG_MK}
echo "LIBS_DEBUG = $LIBS_DEBUG" >> ${CONFIG_MK}
-echo >> ${CONFIG_MK}
-echo "$PROG: $LOCAL_LIBS $OBJECTS" >> ${CONFIG_MK}
-echo " ${LIBTOOL} --tag=CC --mode=link \${CC} \${CFLAGS} \${LDFLAGS} ${OBJECTS} ${LIBS} -o $PROG" >> ${CONFIG_MK}
-
-echo >> ${CONFIG_MK}
-echo "$PROG_ASAN: $LOCAL_LIBS_ASAN $OBJECTS_ASAN" >> ${CONFIG_MK}
-echo " ${LIBTOOL} --tag=CC --mode=link \${CC} \${CFLAGS_ASAN} \${LDFLAGS_ASAN} ${OBJECTS_ASAN} ${LIBS_ASAN} -o $PROG_ASAN" >> ${CONFIG_MK}
+update_build
+update_build_prog
-if $HAVE_GCOV; then
- echo >> ${CONFIG_MK}
- echo "$PROG_COV: $LOCAL_LIBS_COV $OBJECTS_COV" >> ${CONFIG_MK}
- echo " ${LIBTOOL} --tag=CC --mode=link \${CC} \${CFLAGS_COV} \${LDFLAGS_COV} ${OBJECTS_COV} ${LIBS_COV} -o $PROG_COV" >> ${CONFIG_MK}
-fi
-
-echo >> ${CONFIG_MK}
-echo "$PROG_DEBUG: $LOCAL_LIBS_DEBUG $OBJECTS_DEBUG" >> ${CONFIG_MK}
-echo " ${LIBTOOL} --tag=CC --mode=link \${CC} \${CFLAGS_DEBUG} \${LDFLAGS_DEBUG} ${OBJECTS_DEBUG} ${LIBS_DEBUG} -o $PROG_DEBUG" >> ${CONFIG_MK}
-
-for SRC in $SOURCES; do
- echo >> ${CONFIG_MK}
- SRC_LO="$(c2ext .main.lo "$SRC")"
- c_ext_rule .main.lo "$SRC" >> ${CONFIG_MK}
- echo " ${LIBTOOL} --tag=CC --mode=compile \${CC} \${CPPFLAGS} \${CFLAGS} -c $SRC -o $SRC_LO" >> ${CONFIG_MK}
-
- echo >> ${CONFIG_MK}
- SRC_ASAN_LO="$(c2ext .asan.lo "$SRC")"
- c_ext_rule .asan.lo "$SRC" >> ${CONFIG_MK}
- echo " ${LIBTOOL} --tag=CC --mode=compile \${CC} \${CPPFLAGS} \${CFLAGS_ASAN} -c $SRC -o $SRC_ASAN_LO" >> ${CONFIG_MK}
-
- if $HAVE_GCOV; then
- echo >> ${CONFIG_MK}
- SRC_COV_LO="$(c2ext .cov.lo "$SRC")"
- c_ext_rule .cov.lo "$SRC" >> ${CONFIG_MK}
- echo " ${LIBTOOL} --tag=CC --mode=compile \${CC} \${CPPFLAGS} \${CFLAGS_COV} -c $SRC -o $SRC_COV_LO" >> ${CONFIG_MK}
- fi
-
- echo >> ${CONFIG_MK}
- SRC_DEBUG_LO="$(c2ext .debug.lo "$SRC")"
- c_ext_rule .debug.lo "$SRC" >> ${CONFIG_MK}
- echo " ${LIBTOOL} --tag=CC --mode=compile \${CC} \${CPPFLAGS} \${CFLAGS_DEBUG} -c $SRC -o $SRC_DEBUG_LO" >> ${CONFIG_MK}
-done
-
-echo "" >> ${CONFIG_MK}
+build_lo
+build_prog
if [ "x$(uname)" = "xDarwin" ]; then
HAVE_DARWIN=true
diff --git a/ucd2c/configure b/ucd2c/configure
index e9852ed..787ca85 100755
--- a/ucd2c/configure
+++ b/ucd2c/configure
@@ -20,7 +20,7 @@ PROG=ucd2c
SOURCES="ucd2c.c"
echo "SOURCES = $SOURCES" >> ${CONFIG_MK}
-OBJECTS="$(c2lo "$SOURCES")"
+OBJECTS="$(c2ext .main.lo "$SOURCES")"
echo "OBJECTS = $OBJECTS" >> ${CONFIG_MK}
# Default config
@@ -31,7 +31,7 @@ LDFLAGS="${LDFLAGS:=}"
LIBS="${LIBS:=}"
# Common config for all targets
-CFLAGS="$CFLAGS -W -Wall -Werror -std=c99 -pedantic -O0 -ggdb"
+CFLAGS="$CFLAGS -W -Wall -Werror -std=c99 -pedantic -O2"
pkg_config libbsd-overlay
# Main config
@@ -46,15 +46,10 @@ echo "LDFLAGS = $LDFLAGS" >> ${CONFIG_MK}
echo "LIBS = $LIBS" >> ${CONFIG_MK}
echo >> ${CONFIG_MK}
-for SRC in $SOURCES; do
- echo >> ${CONFIG_MK}
- SRC_LO="$(c2lo "$SRC")"
- c_lo_rule "$SRC" >> ${CONFIG_MK}
- echo " ${LIBTOOL} --tag=CC --mode=compile \${CC} \${CPPFLAGS} \${CFLAGS} -c $SRC -o $SRC_LO" >> ${CONFIG_MK}
-done
+update_build
+update_build_prog
-echo >> ${CONFIG_MK}
-echo "$PROG: $OBJECTS" >> ${CONFIG_MK}
-echo " ${LIBTOOL} --tag=CC --mode=link \${CC} \${CFLAGS} \${LDFLAGS} ${OBJECTS} ${LIBS} -o $PROG" >> ${CONFIG_MK}
+build_lo
+build_prog
update_config_mk