File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1414# CROSSCOMPILE crosscompiler prefix, if any
1515# CFLAGS compiler flags for compiling all C files
1616# LDFLAGS linker flags for linking all binaries
17+ # ERL_CFLAGS additional compiler flags for files using Erlang header files
18+ # ERL_EI_INCLUDE_DIR include path to header files (Possibly required for crosscompile)
1719#
1820
1921SRC = c_src/sqlite3_nif.c
@@ -111,6 +113,10 @@ CFLAGS += -DSQLITE_ENABLE_MATH_FUNCTIONS=1
111113CFLAGS += -DSQLITE_ENABLE_RBU=1
112114CFLAGS += -DSQLITE_ENABLE_RTREE=1
113115CFLAGS += -DSQLITE_OMIT_DEPRECATED=1
116+
117+ # Set Erlang-specific compile flags
118+ ERL_CFLAGS ?= -I$(ERL_EI_INCLUDE_DIR )
119+
114120ifneq ($(STATIC_ERLANG_NIF ) ,)
115121 CFLAGS += -DSTATIC_ERLANG_NIF=1
116122endif
@@ -123,7 +129,7 @@ endif
123129
124130$(BUILD ) /% .o : c_src/% .c
125131 @echo " CC $( notdir $@ ) "
126- $(CC ) -c $(CFLAGS ) -o $@ $<
132+ $(CC ) -c $(ERL_CFLAGS ) $( CFLAGS ) -o $@ $<
127133
128134$(LIB_NAME ) : $(OBJ )
129135 @echo " LD $( notdir $@ ) "
Original file line number Diff line number Diff line change @@ -47,6 +47,10 @@ CFLAGS = -DSQLITE_OMIT_DEPRECATED=1 $(CFLAGS)
4747# TODO: We should allow the person building to be able to specify this
4848CFLAGS = -DNDEBUG=1 $(CFLAGS)
4949
50+ # Set Erlang-specific compile flags
51+ !IFNDEF ERL_CFLAGS
52+ ERL_CFLAGS = -I"$(ERL_EI_INCLUDE_DIR)"
53+ !ENDIF
5054
5155all: clean priv\sqlite3_nif.dll
5256
@@ -59,7 +63,7 @@ Makefile.auto.win:
5963!IFDEF ERTS_INCLUDE_PATH
6064priv\sqlite3_nif.dll:
6165 if NOT EXIST "priv" mkdir "priv"
62- $(CC) $(CFLAGS) -I"$(ERTS_INCLUDE_PATH)" -LD -MD -Fe$@ $(SRC)
66+ $(CC) $(ERL_CFLAGS) $( CFLAGS) -I"$(ERTS_INCLUDE_PATH)" -LD -MD -Fe$@ $(SRC)
6367!ELSE
6468priv\sqlite3_nif.dll: Makefile.auto.win
6569 $(NMAKE) -F Makefile.win priv\sqlite3_nif.dll
You can’t perform that action at this time.
0 commit comments