-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmakefile
executable file
·72 lines (53 loc) · 1.73 KB
/
makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
DIRS := ./
SOURCE := $(foreach dir,$(DIRS),$(wildcard $(dir)/*.c))
CPP_SOURCE :=
OBJS := $(patsubst %.c,%.o,$(SOURCE))
CPP_OBJS := $(patsubst %.cpp,%.o,$(CPP_SOURCE))
OBJ_DIR:= $(shell pwd)
LIB_DIR:= ./libs/
#target you can change test to what you want
TARGET := genievendor
#compile and lib parameter
LIBS := -lpthread -lrt -laglog
LDFLAGS :=
DEFINES :=
INCLUDE := -I include \
CFLAGS := -O2 -Wall -MD $(DEFINES) $(INCLUDE) -D_GNU_SOURCE -std=c99 -D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -DOS_TYPE_LINUX -DPLATFORM_IS_BDP
CXXFLAGS:= $(CFLAGS) -DHAVE_CONFIG_H
#CROSS_COMPILE = ../toolchain/external-toolchain-C600/bin/arm-none-linux-gnueabi-
CROSS_COMPILE = arm-none-linux-gnueabi-
AS = $(CROSS_COMPILE)as
LD = $(CROSS_COMPILE)ld
CC = $(CROSS_COMPILE)gcc
CPP = $(CROSS_COMPILE)g++
AR = $(CROSS_COMPILE)ar
NM = $(CROSS_COMPILE)nm
STRIP = $(CROSS_COMPILE)strip
RANLIB = $(CROSS_COMPILE)ranlib
#i think you should do anything here
.PHONY : everything objs clean veryclean rebuild
everything : $(TARGET)
all : $(TARGET)
objs : $(OBJS)
rebuild: veryclean everything
clean :
find . -name "*.o" | xargs rm -f
find . -name "*.d" | xargs rm -f
find . -name "*~" | xargs rm -f
rm -fr $(TARGET)
veryclean : clean
rm -fr $(TARGET)
$(TARGET):$(OBJS) $(CPP_OBJS)
$(CPP) $(CXXFLAGS) -o $@ $(OBJS) $(CPP_OBJS) $(LDFLAGS) $(LIBS) -L $(LIB_DIR)
ls -lh $(TARGET)
@echo "make strip $(TARGET)."
$(STRIP) --strip-unneeded $(TARGET)
ls -lh $(TARGET)
$(OBJS):%.o:%.c
$(CC) $(CXXFLAGS) -c $< -o $@
$(CPP_OBJS):%.o:%.cpp
$(CPP) $(CXXFLAGS) -c $< -o $@
install :
[ ! -d $(dir ../out/bin) ] & mkdir -p ../out/bin/
cp -f genievendor ../out/bin/
@echo "install $(TARGET) to ../out/bin/$(TARGET)"