-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
50 lines (40 loc) · 1.23 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
#
# Copyright (c) 2019 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-BSD-5-Clause-Nordic
#
ifneq (,$(wildcard $(NRFJPROG_PATH)/nrfjprogdll.h))
NRFJPROG_REAL_PATH=$(NRFJPROG_PATH)
else ifneq (,$(wildcard $(NRFJPROG_PATH)/nrfjprog/nrfjprogdll.h))
NRFJPROG_REAL_PATH=$(NRFJPROG_PATH)/nrfjprog
else
NRFJPROG_EXE_PATH=$(shell which nrfjprog)
ifneq (,$(NRFJPROG_EXE_PATH))
NRFJPROG_REAL_PATH=$(dir $(NRFJPROG_EXE_PATH))
endif
endif
NRFJPROG_REAL_PATH := $(NRFJPROG_REAL_PATH:/=)
NRFJPROG_REAL_PATH := $(NRFJPROG_REAL_PATH:/=)
ifeq (,$(NRFJPROG_REAL_PATH))
$(info Directory containing nrfjprog must be in your PATH variable or)
$(info NRFJPROG_PATH pointing that directory must be provided.)
$(error Cannot find nrfjprog directory.)
endif
ifeq (1,$(DEBUG))
CFLAGS=-g -O0
STRIP=echo Skipping strip
else
CFLAGS=-O3
STRIP=strip
endif
-include version.make
all: eth_rtt_link
clean:
rm -f eth_rtt_link
setcap: eth_rtt_link
sudo setcap cap_net_admin=eip ./eth_rtt_link
eth_rtt_link: Makefile version.make *.c *.h
gcc $(CFLAGS) -o $@ -I$(NRFJPROG_REAL_PATH) $(filter %.c,$^) -ldl
$(STRIP) $@
version.make: get_version.sh $(wildcard .git/HEAD) $(wildcard .git/refs/tags/*)
bash get_version.sh