• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#��ǰ·��
2PWD := .
3BASE_PATH := $(PWD)/.
4
5CC :=/usr/bin/gcc
6AR :=/usr/bin/ar
7
8#CC := /opt/toolchains/yocto-32bit-toolchain/sysroots/x86_64-oesdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc
9#AR := /opt/toolchains/yocto-32bit-toolchain/sysroots/x86_64-oesdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-ar
10
11#ͷ�ļ�·��
12INCLUDE_PATH := -I$(BASE_PATH)/include
13
14#����Դ�ļ�
15SOURCE_FILES := $(wildcard $(BASE_PATH)/*.c)
16
17#������
18LIB_FILE_PATH := $(BASE_PATH)/../lib
19
20#���ļ�
21LIB_FILES := -lhilinkbtsdk -lpthread
22
23#�������.o�ļ�
24OBJECTS_PATH := objs
25OBJECTS := $(patsubst %.c, %.o, $(SOURCE_FILES))
26
27#����ѡ��
28COMPILE_FLAGS := -g -O $(INCLUDE_PATH)
29LINK_FLAGS := -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack --data-sections -L$(LIB_FILE_PATH) $(LIB_FILES)
30
31#���뿪ʼ
32.PHONY: all
33all: clean demo
34
35#����
36clean:
37	rm -f $(OBJECTS)
38
39#����
40demo: $(OBJECTS)
41	$(CC) -o $@ $(OBJECTS) $(LINK_FLAGS)
42
43#����.o
44$(OBJECTS):%.o : %.c
45	$(CC) $(COMPILE_FLAGS) -c $< -o $@
46