Skip to content

Commit

Permalink
refine folder as follow:
Browse files Browse the repository at this point in the history
├── src
├── include
├── gear-lib
├── build.sh
└── Makefile
  • Loading branch information
gozfree committed Aug 2, 2019
1 parent 6801a79 commit 2a74175
Show file tree
Hide file tree
Showing 510 changed files with 377 additions and 33 deletions.
118 changes: 118 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
###############################################################################
# common
###############################################################################
#ARCH: linux/pi/android/ios/
ARCH ?= linux
CROSS_PREFIX ?=
OUTPUT ?= /usr/local
BUILD_DIR := $(shell pwd)/../build/
ARCH_INC := $(BUILD_DIR)/$(ARCH).inc
COLOR_INC := $(BUILD_DIR)/color.inc

ifeq ($(ARCH_INC), $(wildcard $(ARCH_INC)))
include $(ARCH_INC)
endif


CC = $(CROSS_PREFIX)gcc
CXX = $(CROSS_PREFIX)g++
LD = $(CROSS_PREFIX)ld
AR = $(CROSS_PREFIX)ar
STRIP = $(CROSS_PREFIX)strip

ifeq ($(COLOR_INC), $(wildcard $(COLOR_INC)))
include $(COLOR_INC)
else
CC_V = $(CC)
CXX_V = $(CXX)
LD_V = $(LD)
AR_V = $(AR)
CP_V = $(CP)
RM_V = $(RM)
endif

###############################################################################
# target and object
###############################################################################
LIBNAME = libgear
VERSION_SH = $(shell pwd)/src/version.sh $(LIBNAME)
VER = $(shell $(VERSION_SH); awk '/define\ $(LIBNAME)_version/{print $$3}' version.h)
TGT_LIB_H = $(LIBNAME).h
TGT_LIB_A = $(LIBNAME).a
TGT_LIB_SO = $(LIBNAME).so
TGT_LIB_SO_VER = $(TGT_LIB_SO).${VER}

OBJS_LIB := $(patsubst %.c,%.o,$(wildcard src/*.c))


###############################################################################
# cflags and ldflags
###############################################################################

ifeq ($(MODE), release)
CFLAGS := -O2 -Wall -Werror -fPIC
LTYPE := release
else
CFLAGS := -g -Wall -Werror -fPIC
LTYPE := debug
endif
ifeq ($(OUTPUT),/usr/local)
OUTLIBPATH := /usr/local
else
OUTLIBPATH := $(OUTPUT)/$(LTYPE)
endif
CFLAGS += $($(ARCH)_CFLAGS)
CFLAGS += -Iinclude
CFLAGS += -I$(OUTPUT)/include

CFLAGS += -DNO_CRYPTO

SHARED := -shared

LDFLAGS := $($(ARCH)_LDFLAGS)
LDFLAGS += -pthread

###############################################################################
# target
###############################################################################
.PHONY : all clean

TGT := $(TGT_LIB_A)
TGT += $(TGT_LIB_SO)

OBJS := $(OBJS_LIB)

all: $(TGT)

%.o:%.c
$(CC_V) -c $(CFLAGS) $< -o $@

$(TGT_LIB_A): $(OBJS_LIB)
$(AR_V) rcs $@ $^

$(TGT_LIB_SO): $(OBJS_LIB)
$(LD_V) -o $@ $^ $(SHARED)
@mv $(TGT_LIB_SO) $(TGT_LIB_SO_VER)
@ln -sf $(TGT_LIB_SO_VER) $(TGT_LIB_SO)


clean:
$(RM_V) -f $(OBJS)
$(RM_V) -f $(TGT)
$(RM_V) -f version.h
$(RM_V) -f $(TGT_LIB_SO)*
$(RM_V) -f $(TGT_LIB_SO_VER)

install:
$(MAKEDIR_OUTPUT)
if [ "$(MODE)" = "release" ];then $(STRIP) $(TGT); fi
$(CP_V) -r $(TGT_LIB_H) $(OUTPUT)/include
$(CP_V) -r $(TGT_LIB_A) $(OUTLIBPATH)/lib
$(CP_V) -r $(TGT_LIB_SO) $(OUTLIBPATH)/lib
$(CP_V) -r $(TGT_LIB_SO_VER) $(OUTLIBPATH)/lib

uninstall:
cd $(OUTPUT)/include/ && rm -f $(TGT_LIB_H)
$(RM_V) -f $(OUTLIBPATH)/lib/$(TGT_LIB_A)
$(RM_V) -f $(OUTLIBPATH)/lib/$(TGT_LIB_SO)
$(RM_V) -f $(OUTLIBPATH)/lib/$(TGT_LIB_SO_VER)
3 changes: 2 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ config_ios()
config_common()
{
STRIP=${CROSS_PREFIX}strip
LIBS_DIR=`pwd`
LIBS_DIR=`pwd`/gear-lib
OUTPUT=${LIBS_DIR}/output/${ARCH}/
}

Expand Down Expand Up @@ -122,6 +122,7 @@ build_module()
return
fi
cd ${LIBS_DIR}/${MODULE}/
echo "cd ${LIBS_DIR}/${MODULE}/"

case $ACTION in
"clean")
Expand Down
13 changes: 11 additions & 2 deletions build/autogen_lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ usage()

mkdir_libfoo()
{
mkdir ${MODULE}
cd ${MODULE}
mkdir gear-lib/${MODULE}
cd gear-lib/${MODULE}
}

autogen_libfoo_h()
Expand Down Expand Up @@ -328,6 +328,14 @@ autogen_version_h
chmod a+x ${VERSION_SH}
}

link_libfoo()
{
cd ../../include/
ln -s ../gear-lib/${LIBFOO_H} .
cd ../src/
ln -s ../gear-lib/${LIBFOO_C} .
}

case $# in
0)
usage;
Expand All @@ -345,4 +353,5 @@ autogen_makefile_nmake
autogen_version_sh
autogen_android_mk
autogen_readme_md
link_libfoo

File renamed without changes.
2 changes: 1 addition & 1 deletion libbase64/Makefile → gear-lib/libbase64/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
ARCH ?= linux
CROSS_PREFIX ?=
OUTPUT ?= /usr/local
BUILD_DIR := $(shell pwd)/../build/
BUILD_DIR := $(shell pwd)/../../build/
ARCH_INC := $(BUILD_DIR)/$(ARCH).inc
COLOR_INC := $(BUILD_DIR)/color.inc

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion libconfig/Makefile → gear-lib/libconfig/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
ARCH ?= linux
CROSS_PREFIX ?=
OUTPUT ?= /usr/local
BUILD_DIR := $(shell pwd)/../build/
BUILD_DIR := $(shell pwd)/../../build/
ARCH_INC := $(BUILD_DIR)/$(ARCH).inc
COLOR_INC := $(BUILD_DIR)/color.inc

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
ARCH ?= linux
CROSS_PREFIX ?=
OUTPUT ?= /usr/local
BUILD_DIR := $(shell pwd)/../build/
BUILD_DIR := $(shell pwd)/../../build/
ARCH_INC := $(BUILD_DIR)/$(ARCH).inc
COLOR_INC := $(BUILD_DIR)/color.inc

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion libdebug/Makefile → gear-lib/libdebug/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
ARCH ?= linux
CROSS_PREFIX ?=
OUTPUT ?= /usr/local
BUILD_DIR := $(shell pwd)/../build/
BUILD_DIR := $(shell pwd)/../../build/
ARCH_INC := $(BUILD_DIR)/$(ARCH).inc
COLOR_INC := $(BUILD_DIR)/color.inc

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion libdict/Makefile → gear-lib/libdict/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
ARCH ?= linux
CROSS_PREFIX ?=
OUTPUT ?= /usr/local
BUILD_DIR := $(shell pwd)/../build/
BUILD_DIR := $(shell pwd)/../../build/
ARCH_INC := $(BUILD_DIR)/$(ARCH).inc
COLOR_INC := $(BUILD_DIR)/color.inc

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion libfile/Makefile → gear-lib/libfile/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
ARCH ?= linux
CROSS_PREFIX ?=
OUTPUT ?= /usr/local
BUILD_DIR := $(shell pwd)/../build/
BUILD_DIR := $(shell pwd)/../../build/
ARCH_INC := $(BUILD_DIR)/$(ARCH).inc
COLOR_INC := $(BUILD_DIR)/color.inc

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion libgevent/Makefile → gear-lib/libgevent/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
ARCH ?= linux
CROSS_PREFIX ?=
OUTPUT ?= /usr/local
BUILD_DIR := $(shell pwd)/../build/
BUILD_DIR := $(shell pwd)/../../build/
ARCH_INC := $(BUILD_DIR)/$(ARCH).inc
COLOR_INC := $(BUILD_DIR)/color.inc

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion libhal/Makefile → gear-lib/libhal/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
ARCH ?= linux
CROSS_PREFIX ?=
OUTPUT ?= /usr/local
BUILD_DIR := $(shell pwd)/../build/
BUILD_DIR := $(shell pwd)/../../build/
ARCH_INC := $(BUILD_DIR)/$(ARCH).inc
COLOR_INC := $(BUILD_DIR)/color.inc

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion libhash/Makefile → gear-lib/libhash/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
ARCH ?= linux
CROSS_PREFIX ?=
OUTPUT ?= /usr/local
BUILD_DIR := $(shell pwd)/../build/
BUILD_DIR := $(shell pwd)/../../build/
ARCH_INC := $(BUILD_DIR)/$(ARCH).inc
COLOR_INC := $(BUILD_DIR)/color.inc

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion libipc/Makefile → gear-lib/libipc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
ARCH ?= linux
CROSS_PREFIX ?=
OUTPUT ?= /usr/local
BUILD_DIR := $(shell pwd)/../build/
BUILD_DIR := $(shell pwd)/../../build/
ARCH_INC := $(BUILD_DIR)/$(ARCH).inc
COLOR_INC := $(BUILD_DIR)/color.inc

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion liblog/Makefile → gear-lib/liblog/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
ARCH ?= linux
CROSS_PREFIX ?=
OUTPUT ?= /usr/local
BUILD_DIR := $(shell pwd)/../build/
BUILD_DIR := $(shell pwd)/../../build/
ARCH_INC := $(BUILD_DIR)/$(ARCH).inc
COLOR_INC := $(BUILD_DIR)/color.inc

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion libmacro/Makefile → gear-lib/libmacro/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
ARCH ?= linux
CROSS_PREFIX ?=
OUTPUT ?= /usr/local
BUILD_DIR := $(shell pwd)/../build/
BUILD_DIR := $(shell pwd)/../../build/
ARCH_INC := $(BUILD_DIR)/$(ARCH).inc
COLOR_INC := $(BUILD_DIR)/color.inc

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion libmp4parser/Makefile → gear-lib/libmp4parser/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
ARCH ?= linux
CROSS_PREFIX ?=
OUTPUT ?= /usr/local
BUILD_DIR := $(shell pwd)/../build/
BUILD_DIR := $(shell pwd)/../../build/
ARCH_INC := $(BUILD_DIR)/$(ARCH).inc
COLOR_INC := $(BUILD_DIR)/color.inc

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion libplugin/Makefile → gear-lib/libplugin/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
ARCH ?= linux
CROSS_PREFIX ?=
OUTPUT ?= /usr/local
BUILD_DIR := $(shell pwd)/../build/
BUILD_DIR := $(shell pwd)/../../build/
ARCH_INC := $(BUILD_DIR)/$(ARCH).inc
COLOR_INC := $(BUILD_DIR)/color.inc

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
ARCH ?= linux
CROSS_PREFIX ?=
OUTPUT ?= /usr/local
BUILD_DIR := $(shell pwd)/../build/
BUILD_DIR := $(shell pwd)/../../build/
ARCH_INC := $(BUILD_DIR)/$(ARCH).inc
COLOR_INC := $(BUILD_DIR)/color.inc

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion libqueue/Makefile → gear-lib/libqueue/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
ARCH ?= linux
CROSS_PREFIX ?=
OUTPUT ?= /usr/local
BUILD_DIR := $(shell pwd)/../build/
BUILD_DIR := $(shell pwd)/../../build/
ARCH_INC := $(BUILD_DIR)/$(ARCH).inc
COLOR_INC := $(BUILD_DIR)/color.inc

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion librbtree/Makefile → gear-lib/librbtree/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
ARCH ?= linux
CROSS_PREFIX ?=
OUTPUT ?= /usr/local
BUILD_DIR := $(shell pwd)/../build/
BUILD_DIR := $(shell pwd)/../../build/
ARCH_INC := $(BUILD_DIR)/$(ARCH).inc
COLOR_INC := $(BUILD_DIR)/color.inc

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion libringbuffer/Makefile → gear-lib/libringbuffer/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
ARCH ?= linux
CROSS_PREFIX ?=
OUTPUT ?= /usr/local
BUILD_DIR := $(shell pwd)/../build/
BUILD_DIR := $(shell pwd)/../../build/
ARCH_INC := $(BUILD_DIR)/$(ARCH).inc
COLOR_INC := $(BUILD_DIR)/color.inc

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion librpc/Makefile → gear-lib/librpc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
ARCH ?= linux
CROSS_PREFIX ?=
OUTPUT ?= /usr/local
BUILD_DIR := $(shell pwd)/../build/
BUILD_DIR := $(shell pwd)/../../build/
ARCH_INC := $(BUILD_DIR)/$(ARCH).inc
COLOR_INC := $(BUILD_DIR)/color.inc

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion librtmp/Makefile → gear-lib/librtmp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
ARCH ?= linux
CROSS_PREFIX ?=
OUTPUT ?= /usr/local
BUILD_DIR := $(shell pwd)/../build/
BUILD_DIR := $(shell pwd)/../../build/
ARCH_INC := $(BUILD_DIR)/$(ARCH).inc
COLOR_INC := $(BUILD_DIR)/color.inc

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion librtsp/Makefile → gear-lib/librtsp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
ARCH ?= linux
CROSS_PREFIX ?=
OUTPUT ?= /usr/local
BUILD_DIR := $(shell pwd)/../build/
BUILD_DIR := $(shell pwd)/../../build/
ARCH_INC := $(BUILD_DIR)/$(ARCH).inc
COLOR_INC := $(BUILD_DIR)/color.inc

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion libskt/Makefile → gear-lib/libskt/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
ARCH ?= linux
CROSS_PREFIX ?=
OUTPUT ?= /usr/local
BUILD_DIR := $(shell pwd)/../build/
BUILD_DIR := $(shell pwd)/../../build/
ARCH_INC := $(BUILD_DIR)/$(ARCH).inc
COLOR_INC := $(BUILD_DIR)/color.inc

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 2a74175

Please sign in to comment.