From a3cf0708df351e9b54080bec7e045dc651aec48f Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Thu, 26 Oct 2017 22:42:12 -0500 Subject: Makefile: Ensure correct compilation on GCC 4.x On GCC 4.9.4, at least backtrace.c fails to compile because of variable declaration in a for statement, which requires -std=c99 or -std=c11. Since we are using ISO C mode instead of a GNU standard, we additionally must define _BSD_SOURCE to expose Dl_info for the dl code. --- Makefile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index b014afc..c595290 100644 --- a/Makefile +++ b/Makefile @@ -30,13 +30,16 @@ LOADER_PATH = /lib/${LOADER_NAME} all: ${LIBGCOMPAT_NAME} ${LOADER_NAME} ${LIBGCOMPAT_NAME}: ${LIBGCOMPAT_OBJ} - $(CC) -o ${LIBGCOMPAT_NAME} -Wl,-soname,${LIBGCOMPAT_NAME} -shared ${LIBGCOMPAT_OBJ} + $(CC) -o ${LIBGCOMPAT_NAME} -Wl,-soname,${LIBGCOMPAT_NAME} \ + -shared ${LIBGCOMPAT_OBJ} ${LOADER_NAME}: ${LOADER_OBJ} $(CC) -o ${LOADER_NAME} -fPIE -static ${LOADER_OBJ} .c.o: - $(CC) -fPIC -DPIC -DLINKER=\"${LINKER_PATH}\" -DLIBGCOMPAT=\"${LIBGCOMPAT_PATH}\" ${CFLAGS} ${CPPFLAGS} -c -o $@ $< + $(CC) -std=c99 -D_BSD_SOURCE -fPIC -DPIC -DLINKER=\"${LINKER_PATH}\" \ + -DLIBGCOMPAT=\"${LIBGCOMPAT_PATH}\" ${CFLAGS} ${CPPFLAGS} \ + -c -o $@ $< clean: rm -f libgcompat/*.o loader/*.o ${LIBGCOMPAT_NAME} ${LOADER_NAME} -- cgit v1.2.3-70-g09d2