-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
94 lines (71 loc) · 2.03 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
######################################################################################
##
## Makefile for Amiigo link
##
## Author: dashesy
##
##
## Major targets:
## all - make all the following targets:
##
## Special targets:
## install - place all scripts and binaries in the conventional directories
## clean - clean up
##
######################################################################################
#==========================================================================
# UTILITIES
#==========================================================================
MKPARENT := mkdir -p `dirname $(1)`
ECHO := @echo
CP := @cp
#==========================================================================
# CONSTANTS
#==========================================================================
CC := gcc
CXX := g++
OUTPUTBIN = amlink
# Additional libraries
LIBS :=
LFLAGS = $(LIBDIRS) $(LIBS)
INCLUDEDIRS := -I.
CFLAGS := -Wall $(INCLUDEDIRS)
# common sources
COMMON_SRC := ./main.c \
./btio.c \
./att.c \
./hcitool.c \
./gapproto.c \
./amlprocess.c \
./amproto.c \
./cmdparse.c \
./amchar.c \
./fwupdate.c \
./amoldproto.c \
# Avoid the need to latest BlueZ
COMMON_SRC += jni/bluetooth.c\
jni/hci.c \
COMMON_OBJS := $(patsubst %.c, .obj/%.o, $(notdir $(COMMON_SRC)))
VPATH := $(sort $(dir $(COMMON_SRC)))
all: prepare ./$(OUTPUTBIN)
install:
@cp ./$(OUTPUTBIN) /usr/bin/$(OUTPUTBIN)
chmod +s /usr/bin/$(OUTPUTBIN)
.PHONY: prepare
prepare:
@mkdir -p .obj
.PHONY: clean
clean:
rm -rf .obj
rm -f ./$(OUTPUTBIN)
# the "common" object files
.obj/%.o : %.cpp Makefile
@echo creating $@ ...
$(CXX) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
.obj/%.o : %.c Makefile
@echo creating $@ ...
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
# This will make the output
./$(OUTPUTBIN): $(COMMON_OBJS)
@echo building output ...
$(CC) -o $(OUTPUTBIN) $(COMMON_OBJS) $(LFLAGS)