-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
80 lines (72 loc) · 2.04 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
########################################
# RN2483 Library Makefile
# author: alexander collins
# date: September 2017 - April 2018
########################################
#
# EXTERNAL
#
include rn2483.cfg #cfg_*
#
# CONSTANTS
#
# system
RM = rm -f
ECHO = echo
# compiler
CC = $(cfg_COMPILER)
AR = ar rcs
# files
TARGET = rn2483.a
DIR_INC = inc/
SOURCES = src/*.c
OBJECTS = *.o
# flags
FLAGS = -I$(DIR_INC)
CFLAGS = -pedantic -Wall -Wextra
#
# BUILD
#
.PHONY: all
all: init inc/config.h $(TARGET) clean
$(TARGET): $(OBJECTS)
$(AR) $(TARGET) $(OBJECTS)
$(OBJECTS): $(SOURCES)
$(CC) -c $(SOURCES) $(FLAGS) $(CFLAGS)
.PHONY: clean
clean:
$(RM) $(OBJECTS)
.SILENT: init
init:
$(RM) inc/config.h
#
# DEPENDENCIES
#
# rn2483.cfg to a C header file (inc/config.h)
.SILENT: inc/config.h
inc/config.h: rn2483.cfg
$(info Writing rn2483 configuration...)
$(ECHO) "/*!" >> $@
$(ECHO) " @file config.h" >> $@
$(ECHO) " @author Alexander Collins ([email protected]" >> $@
$(ECHO) " @date September 2017 - April 2018" >> $@
$(ECHO) " @brief configuration file generated from rn2483.cfg" >> $@
$(ECHO) "*/" >> $@
$(ECHO) "" >> $@
$(ECHO) "#ifndef RN2483_CONFIG" >> $@
$(ECHO) "#define RN2483_CONFIG" >> $@
$(ECHO) "" >> $@
$(ECHO) "#define LoRaWAN_Frequency \"$(cfg_Frequency)\"" >> $@
$(ECHO) "" >> $@
$(ECHO) "#define LoRaWAN_DevAddr \"$(cfg_DevAddr)\"" >> $@
$(ECHO) "#define LoRaWAN_DevEUI \"$(cfg_DevEUI)\"" >> $@
$(ECHO) "#define LoRaWAN_AppEUI \"$(cfg_AppEUI)\"" >> $@
$(ECHO) "#define LoRaWAN_AppKey \"$(cfg_AppKey)\"" >> $@
$(ECHO) "" >> $@
$(ECHO) "#define LoRaWAN_JoinMode \"$(cfg_JoinMode)\"" >> $@
$(ECHO) "" >> $@
$(ECHO) "#define LoRaWAN_DataRate \"$(cfg_DataRate)\"" >> $@
$(ECHO) "" >> $@
$(ECHO) "#define LoRaWAN_Port \"$(cfg_Port)\"" >> $@
$(ECHO) "#endif // RN2483_CONFIG" >> $@
$(ECHO) "" >> $@