summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorJiaojinxing <jiaojinxing1987@gmail.com>2016-08-16 07:13:44 (GMT)
committer Jiaojinxing <jiaojinxing1987@gmail.com>2016-08-16 07:13:44 (GMT)
commitf970be73a6693c8ebf66a8c92334c22cf9bd4270 (patch)
tree04a1381292dac7b5f6c48f79025f1bf5aca4c004
parente88de31a4741090b7fab9843dabe3d8be0d2a927 (diff)
downloadlibzmodem-f970be73a6693c8ebf66a8c92334c22cf9bd4270.zip
libzmodem-f970be73a6693c8ebf66a8c92334c22cf9bd4270.tar.gz
libzmodem-f970be73a6693c8ebf66a8c92334c22cf9bd4270.tar.bz2
Add x86 architecture support.
-rw-r--r--Makefile.x86240
1 files changed, 240 insertions, 0 deletions
diff --git a/Makefile.x86 b/Makefile.x86
index e69de29..b9622a0 100644
--- a/Makefile.x86
+++ b/Makefile.x86
@@ -0,0 +1,240 @@
+#*********************************************************************************************************
+# libzmodem Makefile
+# target -> rz sz
+#*********************************************************************************************************
+
+#*********************************************************************************************************
+# 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
+#*********************************************************************************************************
+RZ_SRCS = \
+zmodem/rz.c
+
+SZ_SRCS = \
+zmodem/sz.c
+
+#*********************************************************************************************************
+# build path
+#*********************************************************************************************************
+ifeq ($(DEBUG_LEVEL), debug)
+OUTDIR = Debug
+else
+OUTDIR = Release
+endif
+
+OUTPATH = ./$(OUTDIR)
+OBJPATH = $(OUTPATH)/obj
+DEPPATH = $(OUTPATH)/dep
+
+#*********************************************************************************************************
+# target
+#*********************************************************************************************************
+RZ = $(OUTPATH)/rz
+STRIP_RZ = $(OUTPATH)/strip/rz
+SZ = $(OUTPATH)/sz
+STRIP_SZ = $(OUTPATH)/strip/sz
+
+#*********************************************************************************************************
+# objects
+#*********************************************************************************************************
+RZ_OBJS = $(addprefix $(OBJPATH)/, $(addsuffix .o, $(basename $(RZ_SRCS))))
+RZ_DEPS = $(addprefix $(DEPPATH)/, $(addsuffix .d, $(basename $(RZ_SRCS))))
+
+SZ_OBJS = $(addprefix $(OBJPATH)/, $(addsuffix .o, $(basename $(SZ_SRCS))))
+SZ_DEPS = $(addprefix $(DEPPATH)/, $(addsuffix .d, $(basename $(SZ_SRCS))))
+
+#*********************************************************************************************************
+# 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"
+
+#*********************************************************************************************************
+# compiler preprocess
+#*********************************************************************************************************
+DSYMBOL = -DSYLIXOS
+DSYMBOL += -DSYLIXOS_LIB
+DSYMBOL += -DPOSIX
+DSYMBOL += -DREGISTERED
+
+#*********************************************************************************************************
+# 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: $(RZ) $(STRIP_RZ) $(SZ) $(STRIP_SZ)
+ @echo create "$(RZ) $(SZ)" success.
+
+#*********************************************************************************************************
+# include depends
+#*********************************************************************************************************
+ifneq ($(MAKECMDGOALS), clean)
+ifneq ($(MAKECMDGOALS), clean_project)
+sinclude $(RZ_DEPS) $(SZ_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 rz object files
+#*********************************************************************************************************
+$(RZ): $(RZ_OBJS)
+ $(LD) $(CPUFLAGS) -Wl,-shared -fPIC -shared -o $(RZ) $(RZ_OBJS) \
+ -L"./Debug" -L"./Release" -L"$(SYLIXOS_BASE_PATH)/libsylixos/$(OUTDIR)" $(DEPEND_DLL_PATH) $(DEPEND_DLL) \
+ -lvpmpdm -lm -lgcc
+
+#*********************************************************************************************************
+# strip rz
+#*********************************************************************************************************
+$(STRIP_RZ): $(RZ)
+ @if [ ! -d "$(dir $@)" ]; then mkdir -p "$(dir $@)"; fi
+ @rm -f $@
+ $(STRIP) $(RZ) -o $(STRIP_RZ)
+
+#*********************************************************************************************************
+# link sz object files
+#*********************************************************************************************************
+$(SZ): $(SZ_OBJS)
+ $(LD) $(CPUFLAGS) -Wl,-shared -fPIC -shared -o $(SZ) $(SZ_OBJS) \
+ -L"./Debug" -L"./Release" -L"$(SYLIXOS_BASE_PATH)/libsylixos/$(OUTDIR)" $(DEPEND_DLL_PATH) $(DEPEND_DLL) \
+ -lvpmpdm -lm -lgcc
+
+#*********************************************************************************************************
+# strip sz
+#*********************************************************************************************************
+$(STRIP_SZ): $(SZ)
+ @if [ ! -d "$(dir $@)" ]; then mkdir -p "$(dir $@)"; fi
+ @rm -f $@
+ $(STRIP) $(SZ) -o $(STRIP_SZ)
+
+#*********************************************************************************************************
+# clean
+#*********************************************************************************************************
+.PHONY: clean
+.PHONY: clean_project
+
+#*********************************************************************************************************
+# clean objects
+#*********************************************************************************************************
+clean:
+ -rm -rf $(RZ)
+ -rm -rf $(STRIP_RZ)
+ -rm -rf $(SZ)
+ -rm -rf $(STRIP_SZ)
+ -rm -rf $(RZ_OBJS)
+ -rm -rf $(SZ_OBJS)
+ -rm -rf $(OBJPATH)
+ -rm -rf $(DEPPATH)
+
+#*********************************************************************************************************
+# clean project
+#*********************************************************************************************************
+clean_project:
+ -rm -rf $(OUTPATH)
+
+#*********************************************************************************************************
+# END
+#*********************************************************************************************************