summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorJiaojinxing <jiaojinxing1987@gmail.com>2016-08-16 07:00:13 (GMT)
committer Jiaojinxing <jiaojinxing1987@gmail.com>2016-08-16 07:00:13 (GMT)
commitec75dc48c3fb3e6d6437b842a80b0e72d4725f28 (patch)
tree31648a2fbcd7b844c260d52742712838c1073dbf
parent2c7a6642e20132d2061848eea0cab6b1bc4b1dc8 (diff)
downloadlibsqlite3-ec75dc48c3fb3e6d6437b842a80b0e72d4725f28.zip
libsqlite3-ec75dc48c3fb3e6d6437b842a80b0e72d4725f28.tar.gz
libsqlite3-ec75dc48c3fb3e6d6437b842a80b0e72d4725f28.tar.bz2
Add x86 architecture support.
-rw-r--r--Makefile.x86259
1 files changed, 259 insertions, 0 deletions
diff --git a/Makefile.x86 b/Makefile.x86
index e69de29..591e9e4 100644
--- a/Makefile.x86
+++ b/Makefile.x86
@@ -0,0 +1,259 @@
+#*********************************************************************************************************
+# libsqlite3 Makefile
+# target -> libsqlite3.a
+# libsqlite3.so
+#*********************************************************************************************************
+
+#*********************************************************************************************************
+# include config.mk
+#*********************************************************************************************************
+CONFIG_MK_EXIST = $(shell if [ -f ../config.mk ]; then echo exist; else echo notexist; fi;)
+ifeq ($(CONFIG_MK_EXIST), exist)
+include ../config.mk
+else
+CONFIG_MK_EXIST = $(shell if [ -f config.mk ]; then echo exist; else echo notexist; fi;)
+ifeq ($(CONFIG_MK_EXIST), exist)
+include config.mk
+else
+CONFIG_MK_EXIST =
+endif
+endif
+
+#*********************************************************************************************************
+# check configure
+#*********************************************************************************************************
+check_defined = \
+ $(foreach 1,$1,$(__check_defined))
+__check_defined = \
+ $(if $(value $1),, \
+ $(error Undefined $1$(if $(value 2), ($(strip $2)))))
+
+$(call check_defined, CONFIG_MK_EXIST, Please configure this project in RealEvo-IDE or \
+create a config.mk file!)
+$(call check_defined, SYLIXOS_BASE_PATH, SylixOS base project path)
+$(call check_defined, TOOLCHAIN_PREFIX, the prefix name of toolchain)
+$(call check_defined, DEBUG_LEVEL, debug level(debug or release))
+
+#*********************************************************************************************************
+# toolchain select
+#*********************************************************************************************************
+CC = $(TOOLCHAIN_PREFIX)gcc
+CXX = $(TOOLCHAIN_PREFIX)g++
+AS = $(TOOLCHAIN_PREFIX)gcc
+AR = $(TOOLCHAIN_PREFIX)ar
+LD = $(TOOLCHAIN_PREFIX)g++
+STRIP = $(TOOLCHAIN_PREFIX)strip
+
+#*********************************************************************************************************
+# do not change the following code
+# buildin internal application source
+#*********************************************************************************************************
+#*********************************************************************************************************
+# src(s) file
+#*********************************************************************************************************
+SRCS_EXE = \
+sqlite3/shell.c
+
+SRCS = \
+sqlite3/sqlite3.c
+
+#*********************************************************************************************************
+# build path
+#*********************************************************************************************************
+ifeq ($(DEBUG_LEVEL), debug)
+OUTDIR = Debug
+else
+OUTDIR = Release
+endif
+
+OUTPATH = ./$(OUTDIR)
+OBJPATH = $(OUTPATH)/obj
+DEPPATH = $(OUTPATH)/dep
+
+#*********************************************************************************************************
+# target
+#*********************************************************************************************************
+LIB = $(OUTPATH)/libsqlite3.a
+DLL = $(OUTPATH)/libsqlite3.so
+EXE = $(OUTPATH)/sqlite3
+STRIP_DLL = $(OUTPATH)/strip/libsqlite3.so
+STRIP_EXE = $(OUTPATH)/strip/sqlite3
+
+#*********************************************************************************************************
+# objects
+#*********************************************************************************************************
+OBJS = $(addprefix $(OBJPATH)/, $(addsuffix .o, $(basename $(SRCS))))
+DEPS = $(addprefix $(DEPPATH)/, $(addsuffix .d, $(basename $(SRCS))))
+
+EXE_OBJS = $(addprefix $(OBJPATH)/, $(addsuffix .o, $(basename $(SRCS_EXE))))
+EXE_DEPS = $(addprefix $(DEPPATH)/, $(addsuffix .d, $(basename $(SRCS_EXE))))
+
+#*********************************************************************************************************
+# include path
+#*********************************************************************************************************
+INCDIR = -I"$(SYLIXOS_BASE_PATH)/libsylixos/SylixOS"
+INCDIR += -I"$(SYLIXOS_BASE_PATH)/libsylixos/SylixOS/include"
+INCDIR += -I"$(SYLIXOS_BASE_PATH)/libsylixos/SylixOS/include/inet"
+INCDIR += -I"$(SYLIXOS_BASE_PATH)/libreadline"
+
+#*********************************************************************************************************
+# compiler preprocess
+#*********************************************************************************************************
+DSYMBOL = -DSYLIXOS
+DSYMBOL += -DSYLIXOS_LIB
+DSYMBOL += -DHAVE_READLINE
+
+#*********************************************************************************************************
+# depend dynamic library
+#*********************************************************************************************************
+DEPEND_DLL = -lreadline -lcextern
+
+#*********************************************************************************************************
+# depend dynamic library search path
+#*********************************************************************************************************
+DEPEND_DLL_PATH = -L"$(SYLIXOS_BASE_PATH)/libreadline/$(OUTDIR)"
+DEPEND_DLL_PATH += -L"$(SYLIXOS_BASE_PATH)/libcextern/$(OUTDIR)"
+
+#*********************************************************************************************************
+# compiler optimize
+#*********************************************************************************************************
+ifeq ($(DEBUG_LEVEL), debug)
+OPTIMIZE = -O0 -g3 -gdwarf-2
+else
+OPTIMIZE = -O2 -g1 -gdwarf-2 # Do NOT use -O3 and -Os
+endif # -Os is not align for function
+ # loop and jump.
+#*********************************************************************************************************
+# depends and compiler parameter (cplusplus in kernel MUST NOT use exceptions and rtti)
+#*********************************************************************************************************
+DEPENDFLAG = -MM
+CXX_EXCEPT = -fno-exceptions -fno-rtti
+COMMONFLAGS = $(CPUFLAGS) $(OPTIMIZE) -Wall -fmessage-length=0 -fsigned-char -fno-short-enums -mlong-double-64
+ASFLAGS = -x assembler-with-cpp $(DSYMBOL) $(INCDIR) $(COMMONFLAGS) -c
+CFLAGS = $(DSYMBOL) $(INCDIR) $(COMMONFLAGS) -fPIC -c
+CXXFLAGS = $(DSYMBOL) $(INCDIR) $(CXX_EXCEPT) $(COMMONFLAGS) -fPIC -c
+ARFLAGS = -r
+
+#*********************************************************************************************************
+# define some useful variable
+#*********************************************************************************************************
+DEPEND = $(CC) $(DEPENDFLAG) $(CFLAGS)
+DEPEND.d = $(subst -g ,,$(DEPEND))
+COMPILE.S = $(AS) $(ASFLAGS)
+COMPILE_VFP.S = $(AS) $(ASFLAGS)
+COMPILE.c = $(CC) $(CFLAGS)
+COMPILE.cxx = $(CXX) $(CXXFLAGS)
+
+#*********************************************************************************************************
+# target
+#*********************************************************************************************************
+all: $(LIB) $(DLL) $(EXE) $(STRIP_DLL) $(STRIP_EXE)
+ @echo create "$(LIB) $(DLL) $(EXE) $(STRIP_DLL) $(STRIP_EXE)" success.
+
+#*********************************************************************************************************
+# include depends
+#*********************************************************************************************************
+ifneq ($(MAKECMDGOALS), clean)
+ifneq ($(MAKECMDGOALS), clean_project)
+sinclude $(DEPS) $(EXE_DEPS)
+endif
+endif
+
+#*********************************************************************************************************
+# create depends files
+#*********************************************************************************************************
+$(DEPPATH)/%.d: %.c
+ @echo creating $@
+ @if [ ! -d "$(dir $@)" ]; then mkdir -p "$(dir $@)"; fi
+ @rm -f $@; \
+ echo -n '$@ $(addprefix $(OBJPATH)/, $(dir $<))' > $@; \
+ $(DEPEND.d) $< >> $@ || rm -f $@; exit;
+
+$(DEPPATH)/%.d: %.cpp
+ @echo creating $@
+ @if [ ! -d "$(dir $@)" ]; then mkdir -p "$(dir $@)"; fi
+ @rm -f $@; \
+ echo -n '$@ $(addprefix $(OBJPATH)/, $(dir $<))' > $@; \
+ $(DEPEND.d) $< >> $@ || rm -f $@; exit;
+
+#*********************************************************************************************************
+# compile source files
+#*********************************************************************************************************
+$(OBJPATH)/%.o: %.S
+ @if [ ! -d "$(dir $@)" ]; then mkdir -p "$(dir $@)"; fi
+ $(COMPILE.S) $< -o $@
+
+$(OBJPATH)/%.o: %.c
+ @if [ ! -d "$(dir $@)" ]; then mkdir -p "$(dir $@)"; fi
+ $(COMPILE.c) $< -o $@
+
+$(OBJPATH)/%.o: %.cpp
+ @if [ ! -d "$(dir $@)" ]; then mkdir -p "$(dir $@)"; fi
+ $(COMPILE.cxx) $< -o $@
+
+#*********************************************************************************************************
+# link libsqlite3.a object files
+#*********************************************************************************************************
+$(LIB): $(OBJS)
+ $(AR) $(ARFLAGS) $(LIB) $(OBJS)
+
+#*********************************************************************************************************
+# link libsqlite3.so object files
+#*********************************************************************************************************
+$(DLL): $(OBJS)
+ $(LD) $(CPUFLAGS) -Wl,-shared -fPIC -shared -o $(DLL) $(OBJS) \
+ -lm -lgcc
+
+#*********************************************************************************************************
+# strip libsqlite3.so
+#*********************************************************************************************************
+$(STRIP_DLL): $(DLL)
+ @if [ ! -d "$(dir $@)" ]; then mkdir -p "$(dir $@)"; fi
+ @rm -f $@
+ $(STRIP) $(DLL) -o $(STRIP_DLL)
+
+#*********************************************************************************************************
+# link sqlite3 object files
+#*********************************************************************************************************
+$(EXE): $(EXE_OBJS) $(DLL)
+ $(LD) $(CPUFLAGS) -Wl,-shared -fPIC -shared -o $(EXE) $(EXE_OBJS) \
+ -L"./Debug" -L"./Release" -L"$(SYLIXOS_BASE_PATH)/libsylixos/$(OUTDIR)" $(DEPEND_DLL_PATH) $(DEPEND_DLL) \
+ -lsqlite3 -lvpmpdm -lm -lgcc
+
+#*********************************************************************************************************
+# strip sqlite3
+#*********************************************************************************************************
+$(STRIP_EXE): $(EXE)
+ @if [ ! -d "$(dir $@)" ]; then mkdir -p "$(dir $@)"; fi
+ @rm -f $@
+ $(STRIP) $(EXE) -o $(STRIP_EXE)
+
+#*********************************************************************************************************
+# clean
+#*********************************************************************************************************
+.PHONY: clean
+.PHONY: clean_project
+
+#*********************************************************************************************************
+# clean objects
+#*********************************************************************************************************
+clean:
+ -rm -rf $(LIB)
+ -rm -rf $(DLL)
+ -rm -rf $(EXE)
+ -rm -rf $(STRIP_DLL)
+ -rm -rf $(STRIP_EXE)
+ -rm -rf $(OBJS)
+ -rm -rf $(EXE_OBJS)
+ -rm -rf $(OBJPATH)
+ -rm -rf $(DEPPATH)
+
+#*********************************************************************************************************
+# clean project
+#*********************************************************************************************************
+clean_project:
+ -rm -rf $(OUTPATH)
+
+#*********************************************************************************************************
+# END
+#*********************************************************************************************************