Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
i-evi committed Jun 21, 2020
1 parent 2e38729 commit 759d142
Show file tree
Hide file tree
Showing 7 changed files with 276 additions and 98 deletions.
43 changes: 29 additions & 14 deletions makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
cc = gcc
CC = gcc

# Build Ctrl Flag
BCTRL =

# Debug flag, cc_assert
DFLAG += -DENABLE_CC_ASSERT
# AddressSanitizer for gcc/clang
DFLAG += -g -fsanitize=address -fno-omit-frame-pointer
DFLAG += # -g -fsanitize=address -fno-omit-frame-pointer

CFLAG += # -std=c89
CFLAG += -Wall # -Wpedantic

OFLAG += -Os
OFLAG += -O3

# Enable OpenMP
OFLAG += -DENABLE_OPENMP -fopenmp
Expand All @@ -23,9 +26,16 @@ CFLAG += -DAUTO_TSRMGR
# will only support bmp image if disabled
3RDSRC_CF += stb

ifneq ($(findstring MINI, $(BCTRL)),)
CC = tcc
CFLAG = -std=c89
CFLAG += -DAUTO_TSRMGR
3RDSRC_CF =
endif

ifneq ($(findstring -std=c89, $(CFLAG)),)
CFLAG += -DCONFIG_STD_C89
ifneq ($(findstring $(cc), gcc clang),)
ifneq ($(findstring $(CC), gcc clang),)
WFLAG += -Wno-long-long
endif
endif
Expand All @@ -37,26 +47,28 @@ ALL_O = catcoon.o cc_tensor.o cc_dtype.o cc_tsrmgr.o cc_fmap2d.o cc_pool2d.o \
cc_conv2d.o cc_normfn.o cc_image.o util_rbt.o util_list.o util_log.o \
util_image.o global_fn_cfg.o

CATCOON_A = libcatcoon.a

APP_NAMES = simple lenet lenet_pack lenet_unpack

ifeq ($(OS),Windows_NT)
RM = del
APPS = $(foreach v, $(APP_NAMES), $(v).exe)
APPS = $(foreach v, $(APP_NAMES), $(v).exe)
else
RM = rm
APPS = $(APP_NAMES)
endif

all: $(APPS)
all: $(APPS) # $(CATCOON_A)

%.o: ./src/%.c
$(cc) -c -o $@ $< $(CFLAG) $(INC)
# APPS For Linux
$(CC) -c -o $@ $< $(CFLAG) $(INC)
# Targets For Linux
%: ./demo/%.c $(ALL_O)
$(cc) -o $@ $< $(ALL_O) $(CFLAG) $(INC) $(LINK)
# APPS For Windows
$(CC) -o $@ $< $(ALL_O) $(CFLAG) $(INC) $(LINK)
# Targets For Windows
%.exe: ./demo/%.c $(ALL_O)
$(cc) -o $@ $< $(ALL_O) $(CFLAG) $(INC) $(LINK)
$(CC) -o $@ $< $(ALL_O) $(CFLAG) $(INC) $(LINK)

global_fn_cfg.o : $(patsubst %, ./src/%, global_fn_cfg.h global_fn_cfg.c)

Expand All @@ -79,13 +91,16 @@ cc_tensor.o : $(patsubst %, ./src/%, cc_tensor.h cc_tensor.c)
util_log.o : $(patsubst %, ./src/%, util_log.h util_log.c)
util_rbt.o : $(patsubst %, ./src/%, util_rbt.h util_rbt.c)
util_list.o : ./src/util_list.h ./src/util_list.c
$(cc) -c -o $@ ./src/util_list.c $(CFLAG) -DENABLE_FOPS
$(CC) -c -o $@ ./src/util_list.c $(CFLAG) -DENABLE_FOPS
UTIM_COND =
ifneq ($(findstring stb, $(3RDSRC_CF)),)
UTIM_COND += -DUSE3RD_STB_IMAGE -I ./src/3rd_party/stb/
endif
util_image.o : ./src/util_image.h ./src/util_image.c
$(cc) -c -o $@ ./src/util_image.c $(CFLAG) $(UTIM_COND)
$(CC) -c -o $@ ./src/util_image.c $(CFLAG) $(UTIM_COND)

minimal:
$(MAKE) "BCTRL = MINI"

clean:
$(RM) *.o && $(RM) $(APPS)
$(RM) *.o && $(RM) $(APPS)
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Catcoon 使用 tensor 进行计算。神经网络的计算过程中,经常产
```c
typedef struct {
list_t *container;
list_t *container;
const char *name;
unsigned char *data;
const cc_int32 *shape;
Expand Down
Loading

0 comments on commit 759d142

Please sign in to comment.