diff --git a/README.md b/README.md index cfaaa34..7cc172b 100644 --- a/README.md +++ b/README.md @@ -110,8 +110,9 @@ BELOW HERE BE DRAGONS %% By default, the following variables are defined: %% CC - C compiler %% CXX - C++ compiler -%% CFLAGS - C compiler -%% CXXFLAGS - C++ compiler +%% CPPFLAGS - C/C++ compiler preprocessor flags +%% CFLAGS - C compiler flags +%% CXXFLAGS - C++ compiler flags %% LDFLAGS - Link flags %% ERL_CFLAGS - default -I paths for erts and ei %% ERL_LDFLAGS - default -L and -lerl_interface -lei diff --git a/src/pc_port_env.erl b/src/pc_port_env.erl index 91d716b..bff108a 100644 --- a/src/pc_port_env.erl +++ b/src/pc_port_env.erl @@ -220,21 +220,21 @@ default_env() -> {"OBJDUMP", get_tool(Arch, "objdump", "objdump")}, {"DRV_CXX_TEMPLATE", - "$CXX -c $CXXFLAGS $DRV_CFLAGS $PORT_IN_FILES -o $PORT_OUT_FILE"}, + "$CXX -c $CPPFLAGS $CXXFLAGS $DRV_CFLAGS $PORT_IN_FILES -o $PORT_OUT_FILE"}, {"DRV_CC_TEMPLATE", - "$CC -c $CFLAGS $DRV_CFLAGS $PORT_IN_FILES -o $PORT_OUT_FILE"}, + "$CC -c $CPPFLAGS $CFLAGS $DRV_CFLAGS $PORT_IN_FILES -o $PORT_OUT_FILE"}, {"DRV_LINK_TEMPLATE", - "$CC $PORT_IN_FILES $LDFLAGS $LDLIBS $DRV_LDFLAGS -o $PORT_OUT_FILE"}, + "$CC $PORT_IN_FILES $CFLAGS $LDFLAGS $LDLIBS $DRV_LDFLAGS -o $PORT_OUT_FILE"}, {"DRV_LINK_CXX_TEMPLATE", - "$CXX $PORT_IN_FILES $LDFLAGS $LDLIBS $DRV_LDFLAGS -o $PORT_OUT_FILE"}, + "$CXX $PORT_IN_FILES $CXXFLAGS $LDFLAGS $LDLIBS $DRV_LDFLAGS -o $PORT_OUT_FILE"}, {"EXE_CXX_TEMPLATE", - "$CXX -c $CXXFLAGS $EXE_CFLAGS $PORT_IN_FILES -o $PORT_OUT_FILE"}, + "$CXX -c $CPPFLAGS $CXXFLAGS $EXE_CFLAGS $PORT_IN_FILES -o $PORT_OUT_FILE"}, {"EXE_CC_TEMPLATE", - "$CC -c $CFLAGS $EXE_CFLAGS $PORT_IN_FILES -o $PORT_OUT_FILE"}, + "$CC -c $CPPFLAGS $CFLAGS $EXE_CFLAGS $PORT_IN_FILES -o $PORT_OUT_FILE"}, {"EXE_LINK_TEMPLATE", - "$CC $PORT_IN_FILES $LDFLAGS $EXE_LDFLAGS -o $PORT_OUT_FILE"}, + "$CC $PORT_IN_FILES $CFLAGS $LDFLAGS $EXE_LDFLAGS -o $PORT_OUT_FILE"}, {"EXE_LINK_CXX_TEMPLATE", - "$CXX $PORT_IN_FILES $LDFLAGS $EXE_LDFLAGS -o $PORT_OUT_FILE"}, + "$CXX $PORT_IN_FILES $CXXFLAGS $LDFLAGS $EXE_LDFLAGS -o $PORT_OUT_FILE"}, {"DRV_CFLAGS" , "-g -Wall -fPIC -MMD $ERL_CFLAGS"}, {"DRV_LDFLAGS", "-shared $ERL_LDFLAGS"}, {"EXE_CFLAGS" , "-g -Wall -fPIC -MMD $ERL_CFLAGS"}, @@ -282,18 +282,18 @@ default_env() -> {"win32", "LINKER", "link.exe"}, {"win32", "DRV_CXX_TEMPLATE", %% DRV_* and EXE_* Templates are identical - "$CXX /c $CXXFLAGS $DRV_CFLAGS $PORT_IN_FILES /Fo$PORT_OUT_FILE"}, + "$CXX /c $CPPFLAGS $CXXFLAGS $DRV_CFLAGS $PORT_IN_FILES /Fo$PORT_OUT_FILE"}, {"win32", "DRV_CC_TEMPLATE", - "$CC /c $CFLAGS $DRV_CFLAGS $PORT_IN_FILES /Fo$PORT_OUT_FILE"}, + "$CC /c $CPPFLAGS $CFLAGS $DRV_CFLAGS $PORT_IN_FILES /Fo$PORT_OUT_FILE"}, {"win32", "DRV_LINK_TEMPLATE", "$LINKER $PORT_IN_FILES $LDFLAGS $DRV_LDFLAGS /OUT:$PORT_OUT_FILE"}, {"win32", "DRV_LINK_CXX_TEMPLATE", "$LINKER $PORT_IN_FILES $LDFLAGS $DRV_LDFLAGS /OUT:$PORT_OUT_FILE"}, %% DRV_* and EXE_* Templates are identical {"win32", "EXE_CXX_TEMPLATE", - "$CXX /c $CXXFLAGS $EXE_CFLAGS $PORT_IN_FILES /Fo$PORT_OUT_FILE"}, + "$CXX /c $CPPFLAGS $CXXFLAGS $EXE_CFLAGS $PORT_IN_FILES /Fo$PORT_OUT_FILE"}, {"win32", "EXE_CC_TEMPLATE", - "$CC /c $CFLAGS $EXE_CFLAGS $PORT_IN_FILES /Fo$PORT_OUT_FILE"}, + "$CC /c $CPPFLAGS $CFLAGS $EXE_CFLAGS $PORT_IN_FILES /Fo$PORT_OUT_FILE"}, {"win32", "EXE_LINK_TEMPLATE", "$LINKER $PORT_IN_FILES $LDFLAGS $EXE_LDFLAGS /OUT:$PORT_OUT_FILE"}, {"win32", "EXE_LINK_CXX_TEMPLATE",