update makefile and cp_logger.h file
| | |
| | | |
| | | extern char *log_str[]; |
| | | |
| | | void cp_log_raw(const char *fmt, ...); |
| | | void cp_log(int level, char *fmt, ...); |
| | | void cp_log_line(int level, char *file, int line, char *fmt, ...); |
| | | void cp_log_set_time_format(char *time_format); |
| | | |
| | | |
| | | extern cp_logger *cp_log_init(cp_logger *log, char *filename, int level, int log_size); |
| | | extern int cp_log_open(void); |
| | | extern void cp_log_set_time_format(char *time_format); |
| | | extern int cp_log_reopen(void); |
| | | extern void cp_log_close(void); |
| | | extern void cp_log_term(void); |
| | | extern void cp_log_raw(const char *fmt, ...); |
| | | extern void cp_log(int level, char *fmt, ...); |
| | | extern void cp_log_line(int level, char *file, int line, char *fmt, ...); |
| | | |
| | | extern void cp_log_dump(int level, char *buf, int len); |
| | | |
| | | |
| | | #ifdef LOG_FILE_LINE |
| | | #define log_trace(fmt, ...) cp_log_line(LOG_LEVEL_TRACE, __FILE__, __LINE__, fmt, ##__VA_ARGS__) |
| | | #define log_info(fmt, ...) cp_log_line(LOG_LEVEL_INFO, __FILE__, __LINE__, fmt, ##__VA_ARGS__) |
| | |
| | | #********************************************************************************* |
| | | # Copyright: (C) 2012 Guo Wenxue <guowenxue@gmail.com> |
| | | # Copyright: (C) 2018 LingYun IoT Studio |
| | | # All rights reserved. |
| | | # |
| | | # Filename: Makefile |
| | |
| | | # static library named lib$(FOLDER_NAME).a orlib $(FOLDER_NAME).so, |
| | | # which depends on the variable $LINK_MODE. |
| | | # |
| | | # Version: 1.0.0(10/08/2011~) |
| | | # Version: 1.0.0 |
| | | # Author: Guo Wenxue <guowenxue@gmail.com> |
| | | # ChangeLog: 1, Release initial version on "10/08/2011 01:29:33 AM" |
| | | # ChangeLog: 1, Release initial version on "11/20/2018 11:29:33 AM" |
| | | # |
| | | #********************************************************************************/ |
| | | |
| | | PWD=$(shell pwd) |
| | | |
| | | #If wanna compile in the subdir, not called by top makefile, uncomment it |
| | | ifneq (${TOP_COMPILE}, YES) |
| | | LOCAL_COMPILE=YES |
| | | endif |
| | | |
| | | LINK_MODE=STATIC |
| | | #MULTHREADS=YES |
| | | |
| | | LIBNAME=$(shell basename ${PWD}) |
| | | STALIB=lib${LIBNAME}.a |
| | | DYNLIB=lib${LIBNAME}.so |
| | | |
| | | CROSS_COMPILE?=/opt/rpi/arm-bcm2708/arm-linux-gnueabihf/bin/arm-linux-gnueabihf- |
| | | |
| | | VPATH= . |
| | | SRCS = $(wildcard ${VPATH}/*.c) |
| | | OBJS = $(patsubst %.c,%.o,$(SRCS)) |
| | | |
| | | #====================================================== |
| | | # ---> Doesn't call by top makefile, compile by local |
| | | #====================================================== |
| | | ifeq (${LOCAL_COMPILE}, YES) |
| | | ARCH?=arm |
| | | #ARCH?=i386 |
| | | CFLAGS+=-fPIC |
| | | TMP=$(shell echo $(ARCH) | tr "[A-Z]" "[a-z]") |
| | | ifneq (,$(filter i386,$(TMP))) |
| | | CROSS_COMPILE= |
| | | else |
| | | CROSS_COMPILE=/opt/rpi/arm-bcm2708/arm-linux-gnueabihf/bin/arm-linux-gnueabihf- |
| | | endif |
| | | |
| | | PRJDIR?=$(shell dirname ${PWD}) |
| | | CFLAGS+=-I${PRJDIR} -g -Wall -Werror |
| | | CFLAGS+=-I${PRJDIR} |
| | | CC = ${CROSS_COMPILE}gcc |
| | | AR = ${CROSS_COMPILE}ar |
| | | |
| | | endif #End local compile |
| | | |
| | | ifeq ("${LINK_MODE}", "STATIC") |
| | | LIBS = ${STALIB} |
| | | else |
| | | LIBS=${DYNLIB} ${STALIB} |
| | | LIBS=${DYNLIB} |
| | | endif |
| | | |
| | | ifeq ("${MULTHREADS}", "YES") |
| | | LDFLAGS+=-lpthread |
| | | CFLAGS+=-DMULTHREADS |
| | | endif |
| | | |
| | | all: entry clean ${LIBS} install |
| | | all: entry ${LIBS} install |
| | | |
| | | entry: |
| | | @echo " "; |
| | |
| | | %.o : %.c |
| | | $(CC) -c $< $(CFLAGS) |
| | | |
| | | test: clean ${LIBS} |
| | | make -C test ARCH=${ARCH} |
| | | |
| | | tag: |
| | | @ctags --c-kinds=+defglmnstuvx --langmap=c:.c.h.ho.hem.het.hec.hev.him.hit.hic.hiv -R . |
| | | @cscope -Rbq |
| | | |
| | | install: |
| | | @if [ ! -z "${LIBS_PATH}" ] ; then \ |
| | | mkdir -p ${LIBS_PATH} ; \ |
| | | cp ${LIBS} ${LIBS_PATH}; \ |
| | | fi; |
| | | |
| | | |
| | | clean: |
| | | @rm -f *.o *.lo *~ |
| | | @rm -f *.o |
| | | @rm -rf *.gdb *.a *.so |
| | | @make clean -C test |
| | | @rm -f *.log |
| | | |
| | | distclean: clean |
| | | @rm -f tags cscope* |
| | | |
| | | .PHONY: clean entry |
| | | |
| | |
| | | #********************************************************************************* |
| | | # Copyright: (C) 2012 CoherentPlus Sdn. Bhd. |
| | | # Copyright: (C) 2018 LingYun IoT Studio |
| | | # All rights reserved. |
| | | # |
| | | # Filename: Makefile |
| | |
| | | # static library named lib$(FOLDER_NAME).a orlib $(FOLDER_NAME).so, |
| | | # which depends on the variable $LINK_MODE. |
| | | # |
| | | # Version: 1.0.0(10/08/2011~) |
| | | # Version: 1.0.0 |
| | | # Author: Guo Wenxue <guowenxue@gmail.com> |
| | | # ChangeLog: 1, Release initial version on "10/08/2011 01:29:33 AM" |
| | | # ChangeLog: 1, Release initial version on "11/20/2018 11:29:33 AM" |
| | | # |
| | | #********************************************************************************/ |
| | | |
| | | PWD=$(shell pwd) |
| | | #TOP_COMPILE=YES |
| | | |
| | | #If wanna compile in the subdir, not called by top makefile, uncomment it |
| | | ifneq (${TOP_COMPILE}, YES) |
| | | LOCAL_COMPILE=YES |
| | | endif |
| | | |
| | | LIBNAME=$(shell basename ${PWD}) |
| | | STALIB=lib${LIBNAME}.a |
| | | DYNLIB=lib${LIBNAME}.so |
| | | |
| | | CROSS_COMPILE?=/opt/rpi/arm-bcm2708/arm-linux-gnueabihf/bin/arm-linux-gnueabihf- |
| | | |
| | | VPATH= . |
| | | SRCS = $(wildcard ${VPATH}/*.c) |
| | | OBJS = $(patsubst %.c,%.o,$(SRCS)) |
| | | |
| | | #====================================================== |
| | | # ---> Doesn't call by top makefile, compile by local |
| | | #====================================================== |
| | | CROSS_COMPILE?=/opt/rpi/arm-bcm2708/arm-linux-gnueabihf/bin/arm-linux-gnueabihf- |
| | | |
| | | PRJDIR?=$(shell dirname ${PWD}) |
| | | CFLAGS+=-I${PRJDIR} |
| | |
| | | #********************************************************************************* |
| | | # Copyright: (C) 2012 CoherentPlus Sdn. Bhd. |
| | | # Copyright: (C) 2018 LingYun IoT Studio |
| | | # All rights reserved. |
| | | # |
| | | # Filename: Makefile |
| | |
| | | # static library named lib$(FOLDER_NAME).a orlib $(FOLDER_NAME).so, |
| | | # which depends on the variable $LINK_MODE. |
| | | # |
| | | # Version: 1.0.0(10/08/2011~) |
| | | # Version: 1.0.0 |
| | | # Author: Guo Wenxue <guowenxue@gmail.com> |
| | | # ChangeLog: 1, Release initial version on "10/08/2011 01:29:33 AM" |
| | | # ChangeLog: 1, Release initial version on "11/20/2018 11:29:33 AM" |
| | | # |
| | | #********************************************************************************/ |
| | | |
| | | PWD=$(shell pwd) |
| | | #TOP_COMPILE=YES |
| | | |
| | | #If wanna compile in the subdir, not called by top makefile, uncomment it |
| | | ifneq (${TOP_COMPILE}, YES) |
| | | LOCAL_COMPILE=YES |
| | | endif |
| | | |
| | | LIBNAME=$(shell basename ${PWD}) |
| | | STALIB=lib${LIBNAME}.a |
| | | DYNLIB=lib${LIBNAME}.so |
| | | |
| | | CROSS_COMPILE?=/opt/rpi/arm-bcm2708/arm-linux-gnueabihf/bin/arm-linux-gnueabihf- |
| | | |
| | | VPATH= . |
| | | SRCS = $(wildcard ${VPATH}/*.c) |
| | | OBJS = $(patsubst %.c,%.o,$(SRCS)) |
| | | |
| | | #====================================================== |
| | | # ---> Doesn't call by top makefile, compile by local |
| | | #====================================================== |
| | | CROSS_COMPILE?=/opt/rpi/arm-bcm2708/arm-linux-gnueabihf/bin/arm-linux-gnueabihf- |
| | | |
| | | PRJDIR?=$(shell dirname ${PWD}) |
| | | CFLAGS+=-I${PRJDIR} |
| | |
| | | #********************************************************************************* |
| | | # Copyright: (C) 2012 CoherentPlus Sdn. Bhd. |
| | | # Copyright: (C) 2018 LingYun IoT Studio |
| | | # All rights reserved. |
| | | # |
| | | # Filename: Makefile |
| | |
| | | # Cross compile the subdir source code and link all the libs to |
| | | # excutable binary file. |
| | | # |
| | | # Version: 1.0.0(10/08/2011~) |
| | | # Version: 1.0.0 |
| | | # Author: Guo Wenxue <guowenxue@gmail.com> |
| | | # ChangeLog: 1, Release initial version on "10/08/2011 01:29:33 AM" |
| | | # ChangeLog: 1, Release initial version on "2018/11/20 11:29:33 AM" |
| | | # |
| | | #********************************************************************************/ |
| | | |
| | |
| | | LIBS_PATH=${TOP_PATH}/.libs |
| | | |
| | | #Excutable binary file runs on platform |
| | | ARCH?=arm |
| | | #ARCH?=i386 |
| | | #ARCH?=arm |
| | | ARCH?=x86 |
| | | |
| | | #Static linked or Dynamic link |
| | | LINK_MODE=STATIC |
| | |
| | | # ================================== |
| | | # ** Cross Compiler Setting ** |
| | | # ================================== |
| | | |
| | | # |
| | | ifeq ("${ARCH}", "x86") |
| | | export CROSS_COMPILE= |
| | | else |
| | | export CROSS_COMPILE=/opt/rpi/arm-bcm2708/arm-linux-gnueabihf/bin/arm-linux-gnueabihf- |
| | | endif |
| | | |
| | | |
| | | # Get alll the source code folder, all the source code in the subdir will be compiled and |
| | | # archive to a static library, named lib${subdir_name}.a |
| | |
| | | MakeSubDir; \ |
| | | if [ -f makefile -o -f Makefile ]; then \ |
| | | pwd; \ |
| | | make $(1); \ |
| | | make $(1) CROSS_COMPILE=${CROSS_COMPILE}; \ |
| | | if [ "$$?" != "0" ]; then \ |
| | | exit 1; \ |
| | | fi; \ |
| | |
| | | |
| | | .PHONY: all |
| | | |
| | | all: entry version prepare binary install |
| | | all: entry prepare binary install |
| | | |
| | | prepare: |
| | | @if [ ! -L cp_library ] ; then \ |
| | |
| | | @echo " ========================================================="; |
| | | @echo " "; |
| | | @make clean |
| | | |
| | | version: |
| | | @echo "/* Generated by makefile, don't Edit it by hand */" > version.h |
| | | @echo '#define DATE "$(COMPILE_DATE)"' >> version.h |
| | | @echo "#define MAJOR 1" >>version.h |
| | | @echo "#define MINOR 0" >>version.h |
| | | @echo "#define REVER 0" >>version.h |
| | | @if [ -f .svn/entries ] ; then \ |
| | | echo "#define SVNVER `sed -n -e 4p .svn/entries`" >>version.h; \ |
| | | else \ |
| | | echo "#define SVNVER 0" >>version.h; \ |
| | | fi; |
| | | @echo "" >> version.h |
| | | @echo '#define version(progname) printf("%s Version %d.%d.%d Build @%05d (%s)\\n", progname, MAJOR, MINOR, REVER,SVNVER, DATE)' >> version.h |
| | | @echo '#define copyright() printf("Copyright (C) 2012 CoherentPlus Sdn. Bhd.\\n")' >>version.h |
| | | @echo '#define banner(progname) {version(progname); copyright(); printf("\\n");}' >>version.h |
| | | @echo "" >> version.h |
| | | |
| | | subdir: |
| | | @$(call LOOPMAKEFUNC,all) |
| | |
| | | clean: |
| | | @$(call LOOPMAKEFUNC,clean) |
| | | @rm -rf ${LIBS_PATH} |
| | | @rm -f version.h |
| | | @rm -f *.o $(APP_BINARY_NAME) |
| | | @rm -f *.elf* |
| | | @rm -f *.gdb |
| | |
| | | #********************************************************************************* |
| | | # Copyright: (C) 2012 CoherentPlus Sdn. Bhd. |
| | | # Copyright: (C) 2018 LingYun IoT Studio |
| | | # All rights reserved. |
| | | # |
| | | # Filename: Makefile |
| | |
| | | # static library named lib$(FOLDER_NAME).a orlib $(FOLDER_NAME).so, |
| | | # which depends on the variable $LINK_MODE. |
| | | # |
| | | # Version: 1.0.0(10/08/2011~) |
| | | # Version: 1.0.0 |
| | | # Author: Guo Wenxue <guowenxue@gmail.com> |
| | | # ChangeLog: 1, Release initial version on "10/08/2011 01:29:33 AM" |
| | | # ChangeLog: 1, Release initial version on "11/20/2018 11:29:33 AM" |
| | | # |
| | | #********************************************************************************/ |
| | | |
| | | PWD=$(shell pwd) |
| | | #TOP_COMPILE=YES |
| | | |
| | | #If wanna compile in the subdir, not called by top makefile, uncomment it |
| | | ifneq (${TOP_COMPILE}, YES) |
| | | LOCAL_COMPILE=YES |
| | | endif |
| | | |
| | | LIBNAME=$(shell basename ${PWD}) |
| | | STALIB=lib${LIBNAME}.a |
| | | DYNLIB=lib${LIBNAME}.so |
| | | |
| | | CROSS_COMPILE?=/opt/rpi/arm-bcm2708/arm-linux-gnueabihf/bin/arm-linux-gnueabihf- |
| | | |
| | | VPATH= . |
| | | SRCS = $(wildcard ${VPATH}/*.c) |
| | | OBJS = $(patsubst %.c,%.o,$(SRCS)) |
| | | |
| | | #====================================================== |
| | | # ---> Doesn't call by top makefile, compile by local |
| | | #====================================================== |
| | | CROSS_COMPILE?=/opt/rpi/arm-bcm2708/arm-linux-gnueabihf/bin/arm-linux-gnueabihf- |
| | | |
| | | PRJDIR?=$(shell dirname ${PWD}) |
| | | CFLAGS+=-I${PRJDIR} |
| | |
| | | #********************************************************************************* |
| | | # Copyright: (C) 2012 CoherentPlus Sdn. Bhd. |
| | | # Copyright: (C) 2018 LingYun IoT Studio |
| | | # All rights reserved. |
| | | # |
| | | # Filename: Makefile |
| | |
| | | # static library named lib$(FOLDER_NAME).a orlib $(FOLDER_NAME).so, |
| | | # which depends on the variable $LINK_MODE. |
| | | # |
| | | # Version: 1.0.0(10/08/2011~) |
| | | # Version: 1.0.0 |
| | | # Author: Guo Wenxue <guowenxue@gmail.com> |
| | | # ChangeLog: 1, Release initial version on "10/08/2011 01:29:33 AM" |
| | | # ChangeLog: 1, Release initial version on "11/20/2018 11:29:33 AM" |
| | | # |
| | | #********************************************************************************/ |
| | | |
| | | PWD=$(shell pwd) |
| | | #TOP_COMPILE=YES |
| | | |
| | | #If wanna compile in the subdir, not called by top makefile, uncomment it |
| | | ifneq (${TOP_COMPILE}, YES) |
| | | LOCAL_COMPILE=YES |
| | | endif |
| | | |
| | | LIBNAME=$(shell basename ${PWD}) |
| | | STALIB=lib${LIBNAME}.a |
| | | DYNLIB=lib${LIBNAME}.so |
| | | |
| | | CROSS_COMPILE?=/opt/rpi/arm-bcm2708/arm-linux-gnueabihf/bin/arm-linux-gnueabihf- |
| | | |
| | | VPATH= . |
| | | SRCS = $(wildcard ${VPATH}/*.c) |
| | | OBJS = $(patsubst %.c,%.o,$(SRCS)) |
| | | |
| | | #====================================================== |
| | | # ---> Doesn't call by top makefile, compile by local |
| | | #====================================================== |
| | | CROSS_COMPILE?=/opt/rpi/arm-bcm2708/arm-linux-gnueabihf/bin/arm-linux-gnueabihf- |
| | | |
| | | PRJDIR?=$(shell dirname ${PWD}) |
| | | CFLAGS+=-I${PRJDIR} |