-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
65 lines (50 loc) · 1.44 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
# 'make depend' use makedepend to automatically generate dependencies
ARCH :=arm
ifeq ($(ARCH),arm)
CC :=arm-unknown-linux-gnueabi-gcc
else
CC :=gcc
endif
# define any directories containing header files
INCLUDES = -Isrc/ #-I/home/newhall/include -I../include
# define library paths in addition to /usr/lib
LFLAGS = # -L/home/newhall/lib -L../lib
# define any libraries to link into executable
LIBS = build/-lRPI # -lmylib -lm
TARGET = build/libRPI.a
SRCS = $(wildcard src/*.c)
OBJS = $(SRCS:.c=.o)
dev: CFLAGS = $(FLAGS)
dev: all
$(TARGET): CFLAGS += -fPIC
$(TARGET): build $(OBJS)
ar rcs $@ $(OBJS)
ranlib $@
all: $(TARGET)
@ echo compile finish
build:
@mkdir -p build
@mkdir -p bin
.PHONY: clean depend test up help
test:
$(CC) $(FLAGS) -ggdb $(INCLUDES) ./test/MainADXL345.c $(OBJS) -o ./bin/test_ADXL345
$(CC) $(FLAGS) -ggdb $(INCLUDES) ./test/blink.c $(OBJS) -o ./bin/test_blink
$(CC) $(FLAGS) -ggdb $(INCLUDES) ./test/grating.c $(OBJS) -o ./bin/test_grating
@echo "make test file complete"
# upload execte file to raspberry
up:
scp -r ../rpi Rpi3:~/workspace
#$(MAIN): $(OBJS)
# $(CC) $(CFLAGS) $(INCLUDES) -o $(MAIN) $(OBJS) $(LFLAGS) $(LIBS)
#.c.o:
# $(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
clean:
rm -rf build $(OBJS) $(TESTS)
rm -f bin/*
depend:
makedepend $(INCLUDES) $^
help:
@echo "all : compile to object file"
@echo "test : generate test file"
@echo "clean : clean project"
@echo "up : upload file to raspberrypi 3"