BigW Consortium Gitlab

Commit d9c0e160 by Shikai Chen

enabled new Makefile build system for user mode SDK

parent 454421d3
PREFIX:=/usr/lib/ # VFD Demo System
# By CSK
#
CPPFLAGS:=--std c++11
INFRA_SOURCE=$(wildcard infra/src/util/*.cc)
INFRA_OBJECT=$(patsubst %.cc,%.o,$(INFRA_SOURCE))
LIBUSBX_WRAP_SOURCE=$(wildcard deps-wraps/libusbx_wrap/src/*.cc) # NOTE: do not alter the order of the folders, they are arranged based on the dependencies
LIBUSBX_WRAP_OBJ=$(patsubst %.cc,%.o,${LIBUSBX_WRAP_SOURCE}) SUBDIRS:= infra \
deps-wraps \
rpusbdisp-drv
LIBRPUSBDISP_DRV_SOURCE=$(wildcard rpusbdisp-drv/src/*.cc)
LIBRPUSBDISP_DRV_OBJ=$(patsubst %.cc,%.o,${LIBRPUSBDISP_DRV_SOURCE})
RPUSBDISPDEMO_SRC=$(wildcard demo/src/*.cc) .PHONY: all clean install listsubs
RPUSBDISPDEMO_OBJ=$(patsubst %.cc,%.o,${RPUSBDISPDEMO_SRC})
.phony: all clean distclean document listsubs:
@for subdir in $(SUBDIRS) ; do $(MAKE) -C $$subdir $(MAKECMDGOALS) || exit 1; done
all: build/rpusbdispdemo all: listsubs
clean: clean: listsubs
rm -rf build
distclean: install: listsubs
rm -rf build
find . -name "*.o" | xargs rm -rf
build/libinfra.a: $(INFRA_OBJECT)
mkdir -p build
ar rc $@ $(INFRA_OBJECT)
$(INFRA_OBJECT): $(INFRA_SOURCE)
g++ -c -o $@ $(CPPFLAGS) -Iinfra/include $(patsubst %.o,%.cc,$@)
build/libdeps_wraps.a: build/deps_wraps/libusbxwrap.a
cp $^ $@
build/deps_wraps/libusbxwrap.a: $(LIBUSBX_WRAP_OBJ)
mkdir -p build/deps_wraps
ar rc $@ $(LIBUSBX_WRAP_OBJ)
$(LIBUSBX_WRAP_OBJ):$(LIBUSBX_WRAP_SOURCE)
g++ -c -o $@ $(CPPFLAGS) -Iinfra/include -Ideps-wraps/libusbx_wrap/include -I/usr/local/include/libusb-1.0 -I/usr/include/libusb-1.0 $(patsubst %.o,%.cc,$@)
build/librpusbdisp-drv.a: $(LIBRPUSBDISP_DRV_OBJ) distclean:
mkdir -p build $(MAKE) clean
ar rc $@ $(LIBRPUSBDISP_DRV_OBJ) rm -r -f config.log config.status Makefile Makefile.conf
rm -r -f .obj .output
$(LIBRPUSBDISP_DRV_OBJ): $(LIBRPUSBDISP_DRV_SOURCE)
g++ -c -o $@ $(CPPFLAGS) -Iinfra/include -Ideps-wraps/libusbx_wrap/include -Irpusbdisp-drv/include $(patsubst %.o,%.cc,$@)
build/rpusbdispdemo: ${RPUSBDISPDEMO_OBJ} build/libinfra.a build/libdeps_wraps.a build/librpusbdisp-drv.a
g++ -o $@ ${RPUSBDISPDEMO_OBJ} $(CPPFLAGS) -Lbuild -L/usr/local/lib -L/usr/lib -lrpusbdisp-drv -ldeps_wraps -linfra -lusb-1.0
${RPUSBDISPDEMO_OBJ}: ${RPUSBDISPDEMO_SRC}
g++ -c -o $@ $(CPPFLAGS) -Iinfra/include -Ideps-wraps/libusbx_wrap/include -Irpusbdisp-drv/include $(patsubst %.o,%.cc,$@)
document:
doxygen Doxygen
# Make Options generated by configure
PREFIX:=@prefix@
OPT_DBG?=@OPT_DBG@
ARCH_PLATFORM:=@ARCH_PLATFORM@
COMPILE_PREFIX:=@COMPILER_PREFIX@
CC:=@CC@
CXX:=@CXX@
LINK:=@CXX@
AR:=@AR@
# VFD Demo System
# By CSK
#
# NOTE: do not alter the order of the folders, they are arranged based on the dependencies
SUBDIRS:= infra \
deps-wraps \
rpusbdisp-drv
.PHONY: all clean install listsubs
listsubs:
@for subdir in $(SUBDIRS) ; do $(MAKE) -C $$subdir $(MAKECMDGOALS) || exit 1; done
all: listsubs
clean: listsubs
install: listsubs
distclean:
$(MAKE) clean
rm -r -f config.log config.status Makefile Makefile.conf
rm -r -f .obj .output
PREFIX:=/usr/lib/
CPPFLAGS+=--std c++11
INFRA_SOURCE=$(wildcard infra/src/util/*.cc)
INFRA_OBJECT=$(patsubst %.cc,%.o,$(INFRA_SOURCE))
LIBUSBX_WRAP_SOURCE=$(wildcard deps-wraps/libusbx_wrap/src/*.cc)
LIBUSBX_WRAP_OBJ=$(patsubst %.cc,%.o,${LIBUSBX_WRAP_SOURCE})
LIBRPUSBDISP_DRV_SOURCE=$(wildcard rpusbdisp-drv/src/*.cc)
LIBRPUSBDISP_DRV_OBJ=$(patsubst %.cc,%.o,${LIBRPUSBDISP_DRV_SOURCE})
RPUSBDISPDEMO_SRC=$(wildcard demo/src/*.cc)
RPUSBDISPDEMO_OBJ=$(patsubst %.cc,%.o,${RPUSBDISPDEMO_SRC})
.phony: all clean distclean document
all: build/rpusbdispdemo
clean:
rm -rf build
distclean:
rm -rf build
find . -name "*.o" | xargs rm -rf
build/libinfra.a: $(INFRA_OBJECT)
mkdir -p build
$(AR) rc $@ $(INFRA_OBJECT)
$(INFRA_OBJECT): $(INFRA_SOURCE)
$(CXX) -c -o $@ $(CPPFLAGS) -Iinfra/include $(patsubst %.o,%.cc,$@)
build/libdeps_wraps.a: build/deps_wraps/libusbxwrap.a
cp $^ $@
build/deps_wraps/libusbxwrap.a: $(LIBUSBX_WRAP_OBJ)
mkdir -p build/deps_wraps
$(AR) rc $@ $(LIBUSBX_WRAP_OBJ)
$(LIBUSBX_WRAP_OBJ):$(LIBUSBX_WRAP_SOURCE)
$(CXX) -c -o $@ $(CPPFLAGS) -Iinfra/include -Ideps-wraps/libusbx_wrap/include -I/usr/local/include/libusb-1.0 -I/usr/include/libusb-1.0 $(patsubst %.o,%.cc,$@)
build/librpusbdisp-drv.a: $(LIBRPUSBDISP_DRV_OBJ)
mkdir -p build
$(AR) rc $@ $(LIBRPUSBDISP_DRV_OBJ)
$(LIBRPUSBDISP_DRV_OBJ): $(LIBRPUSBDISP_DRV_SOURCE)
$(CXX) -c -o $@ $(CPPFLAGS) -Iinfra/include -Ideps-wraps/libusbx_wrap/include -Irpusbdisp-drv/include $(patsubst %.o,%.cc,$@)
build/rpusbdispdemo: ${RPUSBDISPDEMO_OBJ} build/libinfra.a build/libdeps_wraps.a build/librpusbdisp-drv.a
$(CXX) -o $@ ${RPUSBDISPDEMO_OBJ} $(CPPFLAGS) -Lbuild -L/usr/local/lib -L/usr/lib -lrpusbdisp-drv -ldeps_wraps -linfra -lusb-1.0
${RPUSBDISPDEMO_OBJ}: ${RPUSBDISPDEMO_SRC}
$(CXX) -c -o $@ $(CPPFLAGS) -Iinfra/include -Ideps-wraps/libusbx_wrap/include -Irpusbdisp-drv/include $(patsubst %.o,%.cc,$@)
document:
doxygen Doxygen
This source diff could not be displayed because it is too large. You can view the blob instead.
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.61])
AC_INIT(edison_native_playground, 0.1, http://www.csksoft.net)
AC_SYS_LARGEFILE
# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
AC_PROG_RANLIB
AC_PATH_PROG(AR,ar,ar)
# Checks for libraries.
# Checks for header files.
AC_CHECK_HEADERS([fcntl.h stdint.h stdlib.h string.h sys/time.h unistd.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_INLINE
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_TYPE_UINT8_T
# check target platform via current machine type
machine=`uname -m`
if test x$machine = xarmv7l; then
ARCH_PLATFORM=armv7l
else
ARCH_PLATFORM=x86
fi
# check target platform type based on the host arch
case "$host" in
arm-*-*)
ARCH_PLATFORM=armv7l
;;
*86* )
ARCH_PLATFORM=x86
;;
esac
AC_SUBST(ARCH_PLATFORM)
COMPILER_PREFIX=$host
AC_SUBST(COMPILER_PREFIX)
# enable debug
AC_MSG_CHECKING(for debug)
AC_ARG_ENABLE([debug],
[AC_HELP_STRING([--enable-debug],
[Turn off optimization flag and Turn on debug flag. (DEFINE _DEBUG)(default=disable)])],
[OPT_DBG="$enableval"],
[OPT_DBG=no] )
AC_SUBST(OPT_DBG)
# Checks for library functions.
AC_FUNC_FORK
AC_CHECK_FUNCS([clock_gettime ftruncate gettimeofday memset usleep])
AC_CONFIG_FILES([Makefile.conf
Makefile])
AC_OUTPUT
#
# Unified Building System for Linux
# By CSK (csk@live.com)
#
PRJ_ROOT:=..
MOD_NAME:=rpusbdispdemo
include $(PRJ_ROOT)/scripts/def.mak
CSRC = $(shell find . -name "*.c")
CXXCCSRC= $(shell find . -name "*.cc")
EXTRA_FLAGS:=-Wno-deprecated
CDEFS+=
DEP_AR+=
DEP_LIBS+= $(RPUSBDISP_LIBS)
INCLUDES+=
all: $(EXEC_DEST)
additional_clean:
rm -f $(EXEC_DEST)
include $(PRJ_ROOT)/scripts/common.mak
# VFD Demo System
# By CSK
#
# NOTE: do not alter the order of the folders, they are arranged based on the dependencies
SUBDIRS:= libusbx_wrap
.PHONY: all clean install listsubs
listsubs:
@for subdir in $(SUBDIRS) ; do $(MAKE) -C $$subdir $(MAKECMDGOALS) || exit 1; done
all: listsubs
clean: listsubs
install: listsubs
#
# Unified Building System for Linux
# By CSK (csk@live.com)
#
PRJ_ROOT:=../..
MOD_NAME:=usbxwrap
include $(PRJ_ROOT)/scripts/def.mak
CSRC:= $(shell find src -name "*.c")
CXXCCSRC:= $(shell find src -name "*.cc")
EXTRA_FLAGS:=-Wno-deprecated
CDEFS+=
DEP_AR+=
INCLUDES+= -Iinclude -I$(PREFIX)/include/libusb-1.0
all: $(STATIC_DEST)
additional_clean:
rm -f $(STATIC_DEST)
include $(PRJ_ROOT)/scripts/common.mak
#
# Unified Building System for Linux
# By CSK (csk@live.com)
#
PRJ_ROOT:=..
MOD_NAME:=infra
include $(PRJ_ROOT)/scripts/def.mak
CSRC:= $(shell find src -name "*.c")
CXXCCSRC:= $(shell find src -name "*.cc")
EXTRA_FLAGS:=-Wno-deprecated
CDEFS+=
DEP_AR+=
INCLUDES+= -Iinclude
all: $(STATIC_DEST)
additional_clean:
rm -f $(STATIC_DEST)
include $(PRJ_ROOT)/scripts/common.mak
#
# Unified Building System for Linux
# By CSK (csk@live.com)
#
PRJ_ROOT:=..
MOD_NAME:=rpusbdisp-drv
include $(PRJ_ROOT)/scripts/def.mak
CSRC:= $(shell find src -name "*.c")
CXXCCSRC:= $(shell find src -name "*.cc")
EXTRA_FLAGS:=-Wno-deprecated
CDEFS+=
DEP_AR+=$(OUTPUT_ROOT)/infra.a $(OUTPUT_ROOT)/usbxwrap.a $(OUTPUT_ROOT)/rpusbdisp-drv.a
INCLUDES+= -Iinclude \
-I$(PRJ_ABS_ROOT)/deps-wraps/libusbx_wrap/include \
-I$(PREFIX)/include/libusb-1.0
all: $(DYNAMIC_DEST)
additional_clean:
rm -f $(DYNAMIC_DEST)
include $(PRJ_ROOT)/scripts/common.mak
#
# Unified Building System for Linux
# By CSK (csk@live.com)
#
.SUFFIXES: .o .cpp .s .cc
.PHONY: make_subs clean install additional_clean
# collect objs to build
OBJ+= $(patsubst %.c, $(OBJ_ROOT)/%.o,$(filter-out %*.c,$(CSRC)) )
OBJ+= $(patsubst %.cpp, $(OBJ_ROOT)/%.o,$(filter-out %*.cpp,$(CXXSRC)))
OBJ+= $(patsubst %.cc, $(OBJ_ROOT)/%.o,$(filter-out %*.cc,$(CXXCCSRC)))
distclean: additional_distclean clean
clean: additional_clean
rm -f $(OBJ)
rm -f $(DEP_FILE)
$(OBJ_ROOT)/%.o: %.cpp
mkdir -p `dirname $@`
$(CXX) -c $(CXXFLAGS) -fPIC -o $@ $<
$(OBJ_ROOT)/%.o: %.c
mkdir -p `dirname $@`
$(CC) -c $(CFLAGS) -fPIC -o $@ $<
$(OBJ_ROOT)/%.o: %.cc
mkdir -p `dirname $@`
$(CXX) -c $(CXXFLAGS) -fPIC -o $@ $<
#Dependency builing
$(OBJ_ROOT)/%.d: %.c
mkdir -p `dirname $@`
$(CC) -M $(CFLAGS) $< | sed "s;$(notdir $*).o:;$(OBJ_ROOT)/$*.o $(OBJ_ROOT)/$*.d:;" > $@
$(OBJ_ROOT)/%.d: %.cpp
mkdir -p `dirname $@`
$(CXX) -M $(CXXFLAGS) $< | sed "s;$(notdir $*).o:;$(OBJ_ROOT)/$*.o $(OBJ_ROOT)/$*.d:;" > $@
$(OBJ_ROOT)/%.d: %.cc
mkdir -p `dirname $@`
$(CXX) -M $(CXXFLAGS) $< | sed "s;$(notdir $*).o:;$(OBJ_ROOT)/$*.o $(OBJ_ROOT)/$*.d:;" > $@
$(EXEC_DEST): $(OBJ) $(DEP_AR)
mkdir -p `dirname $@`
$(CC) -o $@ $^ -L$(OUTPUT_ROOT) $(LDFLAGS)
$(STATIC_DEST): $(OBJ)
mkdir -p `dirname $@`
@for i in $(OBJ); do echo "$@<=$$i"; $(AR) rcs $@ $$i; done
$(DYNAMIC_DEST): $(OBJ) $(DEP_AR)
mkdir -p `dirname $@`
$(CC) -fPIC -shared -o $@ $^ -L$(OUTPUT_ROOT) $(LDFLAGS)
ifneq ($(MAKECMDGOALS), clean)
sinclude $(DEP_FILE)
endif
#
# Unified Building System for Linux
# By CSK (csk@live.com)
#
include $(PRJ_ROOT)/Makefile.conf
.PHONY: all clean install distclean listsubs
# Path
PRJ_ABS_ROOT:=$(shell cd $(PRJ_ROOT) && pwd)
OBJ_PARENT_ROOT:=$(PRJ_ROOT)/build/obj/$(ARCH_PLATFORM)
OBJ_ROOT:=$(OBJ_PARENT_ROOT)/$(MOD_NAME)
OUTPUT_ROOT:=$(PRJ_ROOT)/build/output/$(ARCH_PLATFORM)
DEP_FILE += $(patsubst %.o, %.d, $(OBJ))
EXEC_FILENAME:=$(MOD_NAME)
EXEC_DEST:=$(OUTPUT_ROOT)/$(EXEC_FILENAME)
DYNAMIC_FILENAME:=lib$(MOD_NAME).so
DYNAMIC_DEST:=$(OUTPUT_ROOT)/$(DYNAMIC_FILENAME)
STATIC_FILENAME:=$(MOD_NAME).a
STATIC_DEST:=$(OUTPUT_ROOT)/$(STATIC_FILENAME)
# Building Flags
ifeq ($(OPT_DBG), yes)
OPT_LVL?=-g
CDEFS+= -D_DEBUG
else
OPT_LVL?=-O2
endif
ifeq ($(ARCH_PLATFORM), armv7l)
TARGET_DEF:=
else
TARGET_DEF:=
endif
CDEFS+= -DTARGET_$(ARCH_PLATFORM)
# Dependencies
INCLUDES+= -I. \
-I$(PRJ_ABS_ROOT) \
-I$(PRJ_ABS_ROOT)/infra/include \
-I$(PRJ_ABS_ROOT)/rpusbdisp-drv/include \
-I$(PRJ_ABS_ROOT)/deps-wraps/libusbx_wrap/include \
-I$(PREFIX)/include
RPUSBDISP_LIBS:=-L$(OUTPUT_ROOT) -lrpusbdisp-drv
DEP_LIBS+= -L$(PREFIX)/lib -lm \
-ldl \
-lpthread \
-lstdc++ \
-lrt \
-lusb-1.0
CFLAGS+= $(CDEFS) $(OPT_LVL) $(INCLUDES) $(TARGET_DEF) $(EXTRA_FLAGS) -Wconversion-null
CXXFLAGS+= $(CFLAGS) -std=c++11
LDFLAGS+= $(DEP_LIBS) -Wl,-rpath-link=$(PREFIX)/lib
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment