summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorSamuel Holland <samuel@sholland.org>2019-01-05 08:58:45 -0600
committerSamuel Holland <samuel@sholland.org>2019-01-05 09:33:36 -0600
commit98b8025edf172ae8d3e0a619249dc1670067b0f0 (patch)
tree56715ce87bea194c70b8b62e3122477d3401d3f2 /Makefile
parentedd703b4171c5fd0790b6a0eb86709b01e435f26 (diff)
downloadgcompat-98b8025edf172ae8d3e0a619249dc1670067b0f0.tar.gz
gcompat-98b8025edf172ae8d3e0a619249dc1670067b0f0.tar.bz2
gcompat-98b8025edf172ae8d3e0a619249dc1670067b0f0.tar.xz
gcompat-98b8025edf172ae8d3e0a619249dc1670067b0f0.zip
Makefile: Clean up compiler invocations
- Respect user CFLAGS and LDFLAGS consistently. - Consistent use of curly braces for variables over parentheses. - Sort flags, putting '-o' at the end for readability of `make` output. - -fPIE doesn't mean anything to the linker Signed-off-by: Samuel Holland <samuel@sholland.org>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile20
1 files changed, 11 insertions, 9 deletions
diff --git a/Makefile b/Makefile
index a7437d1..b2c3fd3 100644
--- a/Makefile
+++ b/Makefile
@@ -46,28 +46,30 @@ LOADER_PATH = /lib/${LOADER_NAME}
ifdef WITH_LIBUCONTEXT
-LIBUCONTEXT_LIBS = -Wl,--no-as-needed -lucontext
LIBUCONTEXT_CFLAGS = -DWITH_LIBUCONTEXT
+LIBUCONTEXT_LIBS = -lucontext
endif
all: ${LIBGCOMPAT_NAME} ${LOADER_NAME}
${LIBGCOMPAT_NAME}: ${LIBGCOMPAT_OBJ}
- $(CC) -o ${LIBGCOMPAT_NAME} -Wl,-soname,${LIBGCOMPAT_NAME} \
- -shared ${LIBGCOMPAT_OBJ} ${LIBUCONTEXT_LIBS}
+ ${CC} ${CFLAGS} ${LDFLAGS} -shared -Wl,-soname,${LIBGCOMPAT_NAME} \
+ -o ${LIBGCOMPAT_NAME} ${LIBGCOMPAT_OBJ} \
+ -Wl,--no-as-needed ${LIBUCONTEXT_LIBS}
${LIBGCOMPAT_OBJ}: ${LIBGCOMPAT_INCLUDE}
${LOADER_NAME}: ${LOADER_OBJ}
- $(CC) -o ${LOADER_NAME} -fPIE -static ${LOADER_OBJ}
+ ${CC} ${CFLAGS} ${LDFLAGS} -static -o ${LOADER_NAME} ${LOADER_OBJ}
.c.o:
- $(CC) -c -D_BSD_SOURCE -DLIBGCOMPAT=\"${LIBGCOMPAT_PATH}\" \
- -DLINKER=\"${LINKER_PATH}\" -DLOADER=\"${LOADER_NAME}\" \
- -Ilibgcompat ${LIBUCONTEXT_CFLAGS} \
- -fPIC -std=c99 -Wall -Wextra -Wno-frame-address \
- -Wno-unused-parameter ${CFLAGS} ${CPPFLAGS} -o $@ $<
+ ${CC} ${CPPFLAGS} ${CFLAGS} -c -D_BSD_SOURCE \
+ -DLIBGCOMPAT='"${LIBGCOMPAT_PATH}"' \
+ -DLINKER='"${LINKER_PATH}"' -DLOADER='"${LOADER_NAME}"' \
+ -fPIC -Ilibgcompat -std=c99 \
+ -Wall -Wextra -Wno-frame-address -Wno-unused-parameter \
+ ${LIBUCONTEXT_CFLAGS} -o $@ $<
clean:
rm -f libgcompat/*.o loader/*.o ${LIBGCOMPAT_NAME} ${LOADER_NAME}