summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@anytun.org>2018-07-23 20:10:36 (GMT)
committerChristian Pointner <equinox@anytun.org>2018-07-23 20:10:36 (GMT)
commitf8c5a1fa2c0e3677a988aa3e607b6b2ecfb28824 (patch)
tree3ea99dd5046698b0497b21604293c6f563787d71
parente81d828271936aead763d3c4401c5ae4681c1c10 (diff)
make usage of compiler flags more standard compliant
-rw-r--r--src/Makefile14
-rwxr-xr-xsrc/configure51
2 files changed, 33 insertions, 32 deletions
diff --git a/src/Makefile b/src/Makefile
index 9d29cb5..5fc6c2b 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -177,7 +177,7 @@ all: $(EXECUTABLES) #libAnysync.a
%.d: %.cpp
@set -e; rm -f $@; \
- $(CXX) -MM $(CXXFLAGS) $< > $@.$$$$; \
+ $(CXX) -MM $(CPPFLAGS) $< > $@.$$$$; \
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$; echo '(re)building $@'
@@ -199,7 +199,7 @@ anytun-nosync$(EXE): $(ANYTUNOBJS) anytun-nosync.o
$(LD) $(ANYTUNOBJS) anytun-nosync.o -o $@ $(LDFLAGS)
anytun-nosync.o: anytun.cpp
- $(CXX) $(CXXFLAGS) -DANYTUN_NOSYNC $< -c -o anytun-nosync.o
+ $(CXX) $(CPPFLAGS) $(CXXFLAGS) -DANYTUN_NOSYNC $< -c -o anytun-nosync.o
anytun-showtables$(EXE): $(ANYSHOWOBJS) $(SYNCOBJS) anytun-showtables.o
$(LD) $(ANYSHOWOBJS) $(SYNCOBJS) anytun-showtables.o -o $@ $(LDFLAGS)
@@ -212,19 +212,19 @@ anytun-controld$(EXE): $(ANYCTROBJS) anytun-controld.o
options.o: options.cpp
- $(CXX) $(CXXFLAGS) -DANYTUN_OPTIONS $< -c -o $@
+ $(CXX) $(CPPFLAGS) $(CXXFLAGS) -DANYTUN_OPTIONS $< -c -o $@
anyCtrOptions.o: options.cpp
- $(CXX) $(CXXFLAGS) -DANYCTR_OPTIONS $< -c -o $@
+ $(CXX) $(CPPFLAGS) $(CXXFLAGS) -DANYCTR_OPTIONS $< -c -o $@
anyConfOptions.o: options.cpp
- $(CXX) $(CXXFLAGS) -DANYCONF_OPTIONS $< -c -o $@
+ $(CXX) $(CPPFLAGS) $(CXXFLAGS) -DANYCONF_OPTIONS $< -c -o $@
nullOptions.o: options.cpp
- $(CXX) $(CXXFLAGS) $< -c -o $@
+ $(CXX) $(CPPFLAGS) $(CXXFLAGS) $< -c -o $@
%.o: %.cpp
- $(CXX) $(CXXFLAGS) $< -c -o $@
+ $(CXX) $(CPPFLAGS) $(CXXFLAGS) $< -c -o $@
libAnysync.a: $(OBJS)
diff --git a/src/configure b/src/configure
index 9cdce48..a1ac576 100755
--- a/src/configure
+++ b/src/configure
@@ -217,12 +217,12 @@ if [ -n "$ERRORS" ] && [ $EBUILD_COMPAT -ne 1 ]; then
fi
if [ $USE_CLANG -eq 0 ]; then
- CXXFLAGS=$CXXFLAGS' -g -Wall -Werror -Wno-error=unused-variable -O2'
- LDFLAGS=$LDFLAGS' -g -Wall -Werror -O2'
+ if [ -z "$CXXFLAGS" ]; then CXXFLAGS='-g -Wall -O2'; fi
+ if [ -z "$LDFLAGS" ]; then LDFLAGS='-g -Wall -O2'; fi
COMPILER='g++'
else
- CXXFLAGS=$CXXFLAGS' -g -O2'
- LDFLAGS=$LDFLAGS' -g -O2'
+ if [ -z "$CXXFLAGS" ]; then CXXFLAGS='-g -O2'; fi
+ if [ -z "$LDFLAGS" ]; then LDFLAGS='-g -O2'; fi
COMPILER='clang++'
fi
@@ -254,8 +254,8 @@ case $TARGET in
ln -sf posix/posixDaemon.h daemonService.h
ln -sf posix/posixDaemon.cpp daemonService.cpp
echo "loading BSD specific TUN Device"
- CXXFLAGS=$CXXFLAGS' -I/usr/local/include'
- LDFLAGS=$LDFLAGS' -L/usr/local/lib -lboost_thread -lboost_serialization -lboost_system -lboost_date_time -lpthread'
+ CPPFLAGS=$CPPFLAGS' -I/usr/local/include'
+ LDFLAGS=$LDFLAGS' -L/usr/local/lib -lboost_thread -lboost_serialization -lboost_system -lboost_date_time -lpthread'
LOG_TARGETS='-DLOG_SYSLOG -DLOG_FILE -DLOG_STDOUT'
INSTALLSYSTEMD=0
;;
@@ -265,7 +265,7 @@ case $TARGET in
rm -f sysExec.hpp
rm -f daemonService.h daemonService.cpp
echo "loading Windows specific TUN Device"
- CXXFLAGS=$CXXFLAGS' -DMINGW -D_WIN32_WINNT=0x0501 -DWIN32_LEAN_AND_MEAN -DBOOST_WINDOWS -fno-strict-aliasing -DBOOST_THREAD_USE_LIB'
+ CPPFLAGS=$CPPFLAGS' -DMINGW -D_WIN32_WINNT=0x0501 -DWIN32_LEAN_AND_MEAN -DBOOST_WINDOWS -fno-strict-aliasing -DBOOST_THREAD_USE_LIB'
LDFLAGS=$LDFLAGS' -lboost_thread_win32 -lboost_serialization -lboost_system -lboost_date_time -lwsock32 -lws2_32'
LOG_TARGETS='-DWIN_EVENTLOG -DLOG_FILE -DLOG_STDOUT'
INSTALLSYSTEMD=0
@@ -276,59 +276,59 @@ case $TARGET in
;;
esac
-CXXFLAGS="$CXXFLAGS $LOG_TARGETS"
+CPPFLAGS="$CPPFLAGS $LOG_TARGETS"
if [ -n "$BOOST_PREFIX" ]; then
- CXXFLAGS="$CXXFLAGS -I\"$BOOST_PREFIX/include\""
+ CPPFLAGS="$CPPFLAGS -I\"$BOOST_PREFIX/include\""
LDFLAGS="$LDFLAGS -L\"$BOOST_PREFIX/lib\""
fi
CRYPTO_LIB_NAME=""
case $CRYPTO_LIB in
gcrypt)
- CXXFLAGS=$CXXFLAGS' -DUSE_GCRYPT'
+ CPPFLAGS=$CPPFLAGS' -DUSE_GCRYPT'
LDFLAGS=$LDFLAGS' -lgcrypt -lgpg-error'
if [ -n "$GCRYPT_PREFIX" ]; then
- CXXFLAGS="$CXXFLAGS -I\"$GCRYPT_PREFIX/include\""
+ CPPFLAGS="$CPPFLAGS -I\"$GCRYPT_PREFIX/include\""
LDFLAGS="$LDFLAGS -L\"$GCRYPT_PREFIX/lib\""
fi
CRYPTO_LIB_NAME="libgcrypt"
echo "using gcrypt library"
;;
nettle)
- CXXFLAGS=$CXXFLAGS' -DUSE_NETTLE'
+ CPPFLAGS=$CPPFLAGS' -DUSE_NETTLE'
LDFLAGS=$LDFLAGS' -lnettle'
if [ -n "$NETTLE_PREFIX" ]; then
- CXXFLAGS="$CXXFLAGS -I\"$NETTLE_PREFIX/include\""
+ CPPFLAGS="$CPPFLAGS -I\"$NETTLE_PREFIX/include\""
LDFLAGS="$LDFLAGS -L\"$NETTLE_PREFIX/lib\""
fi
CRYPTO_LIB_NAME="Nettle"
echo "using nettle library"
;;
ssl)
- CXXFLAGS=$CXXFLAGS' -DUSE_SSL_CRYPTO'
+ CPPFLAGS=$CPPFLAGS' -DUSE_SSL_CRYPTO'
LDFLAGS=$LDFLAGS' -lcrypto'
if [ -n "$OPENSSL_PREFIX" ]; then
- CXXFLAGS="$CXXFLAGS -I\"$OPENSSL_PREFIX/include\""
+ CPPFLAGS="$CPPFLAGS -I\"$OPENSSL_PREFIX/include\""
LDFLAGS="$LDFLAGS -L\"$OPENSSL_PREFIX/lib\""
fi
CRYPTO_LIB_NAME="OpenSSL"
echo "using openssl crypto library"
;;
none)
- CXXFLAGS=$CXXFLAGS' -DNO_CRYPT'
+ CPPFLAGS=$CPPFLAGS' -DNO_CRYPT'
CRYPTO_LIB_NAME="none"
echo "disabling crypto"
;;
esac
if [ $PASSPHRASE -eq 0 ]; then
- CXXFLAGS=$CXXFLAGS' -DNO_PASSPHRASE'
+ CPPFLAGS=$CPPFLAGS' -DNO_PASSPHRASE'
echo "disabling master key and salt passphrase"
fi
if [ $ROUTING -eq 0 ]; then
- CXXFLAGS=$CXXFLAGS' -DNO_ROUTING'
+ CPPFLAGS=$CPPFLAGS' -DNO_ROUTING'
echo "disabling built-in routing capability"
fi
@@ -373,13 +373,14 @@ cat > include.mk <<EOF
# do not edit this file directly
# use ./configure instead
-TARGET = $TARGET
-CXX = ${CROSS_PREFIX}$COMPILER
-CXXFLAGS = $CXXFLAGS
-LD = ${CROSS_PREFIX}$COMPILER
-LDFLAGS = $LDFLAGS
-STRIP = ${CROSS_PREFIX}strip
-INSTALL = install
+TARGET := $TARGET
+CXX := ${CROSS_PREFIX}$COMPILER
+CPPFLAGS := $CPPFLAGS
+CXXFLAGS := $CXXFLAGS
+LD := ${CROSS_PREFIX}$COMPILER
+LDFLAGS := $LDFLAGS
+STRIP := ${CROSS_PREFIX}strip
+INSTALL := install
prefix := $PREFIX
BINDIR := $BINDIR