Commit 50a334e4 authored by Måns Rullgård's avatar Måns Rullgård

Separate C preprocessor flags into CPPFLAGS variable

Originally committed as revision 19404 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 95a61cfc
...@@ -18,16 +18,17 @@ endif ...@@ -18,16 +18,17 @@ endif
ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale
CFLAGS := -DHAVE_AV_CONFIG_H -I$(BUILD_ROOT_REL) -I$(SRC_PATH) $(OPTFLAGS) CPPFLAGS += -DHAVE_AV_CONFIG_H -I$(BUILD_ROOT_REL) -I$(SRC_PATH)
CFLAGS := $(OPTFLAGS)
%.o: %.c %.o: %.c
$(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $< $(CC) $(CPPFLAGS) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
%.o: %.S %.o: %.S
$(AS) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $< $(AS) $(CPPFLAGS) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
%.ho: %.h %.ho: %.h
$(CC) $(CFLAGS) $(LIBOBJFLAGS) -Wno-unused -c -o $@ -x c $< $(CC) $(CPPFLAGS) $(CFLAGS) $(LIBOBJFLAGS) -Wno-unused -c -o $@ -x c $<
%.d: %.c %.d: %.c
$(DEPEND_CMD) > $@ $(DEPEND_CMD) > $@
......
...@@ -511,6 +511,10 @@ append(){ ...@@ -511,6 +511,10 @@ append(){
eval "$var=\"\$$var $*\"" eval "$var=\"\$$var $*\""
} }
add_cppflags(){
append CPPFLAGS "$@"
}
add_cflags(){ add_cflags(){
append CFLAGS "$@" append CFLAGS "$@"
} }
...@@ -532,21 +536,21 @@ check_cc(){ ...@@ -532,21 +536,21 @@ check_cc(){
log check_cc "$@" log check_cc "$@"
cat > $TMPC cat > $TMPC
log_file $TMPC log_file $TMPC
check_cmd $cc $CFLAGS "$@" -c -o $TMPO $TMPC check_cmd $cc $CPPFLAGS $CFLAGS "$@" -c -o $TMPO $TMPC
} }
check_cpp(){ check_cpp(){
log check_cpp "$@" log check_cpp "$@"
cat > $TMPC cat > $TMPC
log_file $TMPC log_file $TMPC
check_cmd $cc $CFLAGS "$@" -E -o $TMPO $TMPC check_cmd $cc $CPPFLAGS "$@" -E -o $TMPO $TMPC
} }
check_as(){ check_as(){
log check_as "$@" log check_as "$@"
cat > $TMPC cat > $TMPC
log_file $TMPC log_file $TMPC
check_cmd $as $CFLAGS "$@" -c -o $TMPO $TMPC check_cmd $as $CPPFLAGS $CFLAGS "$@" -c -o $TMPO $TMPC
} }
check_asm(){ check_asm(){
...@@ -578,6 +582,13 @@ check_ld(){ ...@@ -578,6 +582,13 @@ check_ld(){
check_cmd $cc $LDFLAGS $flags -o $TMPE $TMPO $extralibs $libs check_cmd $cc $LDFLAGS $flags -o $TMPE $TMPO $extralibs $libs
} }
check_cppflags(){
log check_cppflags "$@"
check_cc "$@" <<EOF && add_cppflags "$@"
int x;
EOF
}
check_cflags(){ check_cflags(){
log check_cflags "$@" log check_cflags "$@"
check_cc "$@" <<EOF && add_cflags "$@" check_cc "$@" <<EOF && add_cflags "$@"
...@@ -1235,7 +1246,7 @@ enable stripping ...@@ -1235,7 +1246,7 @@ enable stripping
enable swscale_alpha enable swscale_alpha
# build settings # build settings
add_cflags -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 add_cppflags -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112
SHFLAGS='-shared -Wl,-soname,$$(@F)' SHFLAGS='-shared -Wl,-soname,$$(@F)'
FFSERVERLDFLAGS=-Wl,-E FFSERVERLDFLAGS=-Wl,-E
LIBPREF="lib" LIBPREF="lib"
...@@ -1256,7 +1267,7 @@ target_path='.' ...@@ -1256,7 +1267,7 @@ target_path='.'
# gcc stupidly only outputs the basename of targets with -MM, but we need the # gcc stupidly only outputs the basename of targets with -MM, but we need the
# full relative path for objects in subdirectories for non-recursive Make. # full relative path for objects in subdirectories for non-recursive Make.
DEPEND_CMD='$(CC) $(CFLAGS) -MM $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o,"' DEPEND_CMD='$(CC) $(CPPFLAGS) -MM $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o,"'
# find source path # find source path
source_path="$(dirname "$0")" source_path="$(dirname "$0")"
...@@ -1456,7 +1467,7 @@ elif $cc -v 2>&1 | grep -q xlc; then ...@@ -1456,7 +1467,7 @@ elif $cc -v 2>&1 | grep -q xlc; then
cc_type=xlc cc_type=xlc
elif $cc -V 2>/dev/null | grep -q Compaq; then elif $cc -V 2>/dev/null | grep -q Compaq; then
cc_type=ccc cc_type=ccc
DEPEND_CMD='$(CC) $(CFLAGS) -M $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o,"' DEPEND_CMD='$(CC) $(CPPFLAGS) -M $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o,"'
debuglevel=3 debuglevel=3
add_ldflags -Wl,-z,now # calls to libots crash without this add_ldflags -Wl,-z,now # calls to libots crash without this
elif $cc --vsn 2>/dev/null | grep -q RVCT; then elif $cc --vsn 2>/dev/null | grep -q RVCT; then
...@@ -1499,10 +1510,10 @@ if test "$?" != 0; then ...@@ -1499,10 +1510,10 @@ if test "$?" != 0; then
fi fi
check_cflags -std=c99 check_cflags -std=c99
check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cflags -D_FILE_OFFSET_BITS=64 check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cppflags -D_FILE_OFFSET_BITS=64
#include <stdlib.h> #include <stdlib.h>
EOF EOF
check_cc -D_LARGEFILE_SOURCE <<EOF && add_cflags -D_LARGEFILE_SOURCE check_cc -D_LARGEFILE_SOURCE <<EOF && add_cppflags -D_LARGEFILE_SOURCE
#include <stdlib.h> #include <stdlib.h>
EOF EOF
...@@ -1593,7 +1604,8 @@ case $target_os in ...@@ -1593,7 +1604,8 @@ case $target_os in
beos|haiku|zeta) beos|haiku|zeta)
prefix_default="$HOME/config" prefix_default="$HOME/config"
# helps building libavcodec # helps building libavcodec
add_cflags -DPIC -fomit-frame-pointer add_cppflags -DPIC
add_cflags -fomit-frame-pointer
# 3 gcc releases known for BeOS, each with ugly bugs # 3 gcc releases known for BeOS, each with ugly bugs
gcc_version="$($cc -v 2>&1 | grep version | cut -d ' ' -f3-)" gcc_version="$($cc -v 2>&1 | grep version | cut -d ' ' -f3-)"
case "$gcc_version" in case "$gcc_version" in
...@@ -1620,7 +1632,7 @@ case $target_os in ...@@ -1620,7 +1632,7 @@ case $target_os in
FFSERVERLDFLAGS="" FFSERVERLDFLAGS=""
SHFLAGS='-shared -Wl,-h,$$(@F)' SHFLAGS='-shared -Wl,-h,$$(@F)'
network_extralibs="-lsocket -lnsl" network_extralibs="-lsocket -lnsl"
add_cflags -D__EXTENSIONS__ add_cppflags -D__EXTENSIONS__
;; ;;
netbsd) netbsd)
oss_indev_extralibs="-lossaudio" oss_indev_extralibs="-lossaudio"
...@@ -2472,6 +2484,7 @@ enabled stripping && ...@@ -2472,6 +2484,7 @@ enabled stripping &&
echo "STRIP=$strip" >> config.mak || echo "STRIP=$strip" >> config.mak ||
echo "STRIP=echo ignoring strip" >> config.mak echo "STRIP=echo ignoring strip" >> config.mak
echo "CPPFLAGS?=$CPPFLAGS" >> config.mak
echo "OPTFLAGS=$CFLAGS" >> config.mak echo "OPTFLAGS=$CFLAGS" >> config.mak
echo "LDFLAGS=$LDFLAGS" >> config.mak echo "LDFLAGS=$LDFLAGS" >> config.mak
echo "FFSERVERLDFLAGS=$FFSERVERLDFLAGS" >> config.mak echo "FFSERVERLDFLAGS=$FFSERVERLDFLAGS" >> config.mak
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment