Bug#264413: OCamlMakefile: should use the CPPFLAGS variable
Package: ocaml-tools
Version: 2004.07.26-1
Severity: wishlist
Tags: patch
Hi,
OCamlMakefile uses CFLAGS to give options to the C preprocessor (such
as -DFOO), whereas the variable used in this case is usually CPPFLAGS.
The following patch (against the version of OCamlMakefile included in
ocaml-tools/2004.07.26-1), separates the cc and cpp options in their own
variables. It works for me, but I have not tested all possible uses for
OCamlMakefile, so I could have overlooked something.
Regards,
Julien Cristau
*** OCamlMakefile.diff
--- OCamlMakefile 2004-07-15 17:25:12.000000000 +0200
+++ OCamlMakefile.new 2004-08-08 20:05:00.000000000 +0200
@@ -105,7 +105,7 @@
export MSVC
WIN32 := 1
ifndef STATIC
- CFLAGS_WIN32 := -DCAML_DLL
+ CPPFLAGS_WIN32 := -DCAML_DLL
endif
CFLAGS_WIN32 += -nologo
EXT_OBJ := obj
@@ -150,6 +150,7 @@
export CFLAGS
export CXXFLAGS
export LDFLAGS
+export CPPFLAGS
ifndef RPATH_FLAG
RPATH_FLAG := -R
@@ -157,12 +158,16 @@
export RPATH_FLAG
ifndef MSVC
-ifndef PIC_FLAGS
- PIC_FLAGS := -fPIC -DPIC
+ifndef PIC_CFLAGS
+ PIC_CFLAGS := -fPIC
+endif
+ifndef PIC_CPPFLAGS
+ PIC_CPPFLAGS := -DPIC
endif
endif
-export PIC_FLAGS
+export PIC_CFLAGS
+export PIC_CPPFLAGS
BCRESULT := $(addsuffix $(BCSUFFIX), $(RESULT))
NCRESULT := $(addsuffix $(NCSUFFIX), $(RESULT))
@@ -350,6 +355,7 @@
export C_OXRIDL
export SUBPROJS
export CFLAGS_WIN32
+export CPPFLAGS_WIN32
INCFLAGS :=
SHELL := /bin/sh
@@ -569,7 +575,8 @@
MAKE_DEPS := $(MLDEPS) $(BCDEPIS)
ifdef CREATE_LIB
- CFLAGS := $(PIC_FLAGS) $(CFLAGS)
+ CFLAGS := $(PIC_CFLAGS) $(CFLAGS)
+ CPPFLAGS := $(PIC_CPPFLAGS) $(CPPFLAGS)
ifndef STATIC
ifneq ($(strip $(OBJ_LINK)),)
MAKEDLL := $(DLLSONAME)
@@ -617,7 +624,7 @@
REAL_IMPL_INTF := $(IMPLX_INTF)
IMPL_SUF := .cmx
- CFLAGS := -DNATIVE_CODE $(CFLAGS)
+ CPPFLAGS := -DNATIVE_CODE $(CPPFLAGS)
DEPFLAGS := -native
MAKE_DEPS := $(MLDEPS) $(NCDEPIS)
@@ -629,7 +636,8 @@
ifndef CREATE_LIB
ALL_LDFLAGS += $(LIBS:%=%.cmxa)
else
- CFLAGS := $(PIC_FLAGS) $(CFLAGS)
+ CFLAGS := $(PIC_CFLAGS) $(CFLAGS)
+ CPPFLAGS := $(PIC_CPPFLAGS) $(CPPFLAGS)
endif
ifdef THREADS
@@ -983,10 +991,12 @@
.c.$(EXT_OBJ):
$(OCAMLC) -c -cc "$(CC)" -ccopt "$(CFLAGS) \
+ $(CPPFLAGS) $(CPPFLAGS_WIN32) \
$(CFLAGS_WIN32) $(CINCFLAGS) $(CFLAG_O)$@ " $<
.$(EXT_CXX).$(EXT_OBJ):
- $(CXX) -c $(CXXFLAGS) $(CINCFLAGS) -I'$(OCAMLLIBPATH)' \
+ $(CXX) -c $(CXXFLAGS) $(CINCFLAGS) $(CPPFLAGS) \
+ -I'$(OCAMLLIBPATH)' \
$< $(CFLAG_O)$@
$(MLDEPDIR)/%.d: %.ml
-- System Information:
Debian Release: 3.1
APT prefers testing
APT policy: (990, 'testing'), (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.7
Locale: LANG=C, LC_CTYPE=C
Reply to: