Skip to content

Commit

Permalink
Use CPP, CC and flags in dep check scripts
Browse files Browse the repository at this point in the history
Allow build systems without standard cc to successfully run the
dependency checking helper scripts from the Makefile.
This supports custom compilers specified by the common CC environment
variable, preprocessors given as CPP and additional preprocessor flags
from CPPFLAGS.
Additional flags from CFLAGS and LDFLAGS are considered for compiling/linking.
Overall, this facilitates cross-compilation and similar setups.

Signed-off-by: Marcel Bargull <[email protected]>
  • Loading branch information
mbargull committed Nov 6, 2020
1 parent f1be2dc commit 06d2d0c
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion hack/btrfs_installed_tag.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
cc -E - > /dev/null 2> /dev/null << EOF
${CPP:-${CC:-cc} -E} ${CPPFLAGS} - > /dev/null 2> /dev/null << EOF
#include <btrfs/ioctl.h>
EOF
if test $? -ne 0 ; then
Expand Down
2 changes: 1 addition & 1 deletion hack/btrfs_tag.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
cc -E - > /dev/null 2> /dev/null << EOF
${CPP:-${CC:-cc} -E} ${CPPFLAGS} - > /dev/null 2> /dev/null << EOF
#include <btrfs/version.h>
EOF
if test $? -ne 0 ; then
Expand Down
2 changes: 1 addition & 1 deletion hack/libdm_tag.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
tmpdir="$PWD/tmp.$RANDOM"
mkdir -p "$tmpdir"
trap 'rm -fr "$tmpdir"' EXIT
cc -o "$tmpdir"/libdm_tag -ldevmapper -x c - > /dev/null 2> /dev/null << EOF
${CC:-cc} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} -o "$tmpdir"/libdm_tag -x c - -ldevmapper > /dev/null 2> /dev/null << EOF
#include <libdevmapper.h>
int main() {
struct dm_task *task;
Expand Down
2 changes: 1 addition & 1 deletion hack/systemd_tag.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
cc -E - > /dev/null 2> /dev/null << EOF
${CPP:-${CC:-cc} -E} ${CPPFLAGS} - > /dev/null 2> /dev/null << EOF
#include <systemd/sd-daemon.h>
EOF
if test $? -eq 0 ; then
Expand Down

0 comments on commit 06d2d0c

Please sign in to comment.