summaryrefslogtreecommitdiff
path: root/libloragw/Makefile
diff options
context:
space:
mode:
authorSylvain Miermont <smiermont@semtech.com>2013-09-19 15:46:06 +0200
committerSylvain Miermont <smiermont@semtech.com>2013-10-23 14:03:05 +0200
commitb922932d1c9869d82042b600db2382d8c15f63dc (patch)
treeb97b83a74f5b3faadb674867f6cc004b8426a8a9 /libloragw/Makefile
parent68b8b7a70d9104888997174506fbbaa0abb12a4c (diff)
downloadlora_gateway-b922932d1c9869d82042b600db2382d8c15f63dc.tar.gz
lora_gateway-b922932d1c9869d82042b600db2382d8c15f63dc.tar.bz2
lora_gateway-b922932d1c9869d82042b600db2382d8c15f63dc.zip
Beta 7 (beta6 skipped)v1.b7
- API: change memory allocation for payload, they are now part of the struct for TX/RX, no need to malloc/free - reduced number of SPI transactions to fetch a packet (improved number a packets par second that can be downloaded from gateway) - streamlined build process, main target is now a static library: libloragw.a - All RX chains can use any of the two radios now - FSK is available and working in TX and RX (variable length mode) - Calibrated RSSI for FSK - lgw_connect now check the CHIP_ID - Added a license file and a changelog - Added a function returning a version string to allow identification of the version/options once compiled
Diffstat (limited to 'libloragw/Makefile')
-rw-r--r--libloragw/Makefile77
1 files changed, 77 insertions, 0 deletions
diff --git a/libloragw/Makefile b/libloragw/Makefile
new file mode 100644
index 0000000..38d2fae
--- /dev/null
+++ b/libloragw/Makefile
@@ -0,0 +1,77 @@
+# putting the configuration in a separate file
+include library.cfg
+
+# constant symbols
+CC=gcc
+CFLAGS=-O2 -Iinc -I.
+C99FLAGS=-O2 -std=c99 -Iinc -I.
+
+# configuration-dependant symbols
+ifeq ($(LGW_PHY),native)
+LDFLAGS=-lrt
+endif
+ifeq ($(LGW_PHY),ftdi)
+LDFLAGS=-lrt -lmpsse
+endif
+
+# general build targets
+
+all: libloragw.a test_loragw_spi test_loragw_reg test_loragw_hal
+
+clean:
+ rm -f *.a
+ rm -f test_*
+ rm -f obj/*.o
+ rm -f .conf_ok
+
+.conf_ok: library.cfg
+ @echo "*** Checking Lora gateway HAL library config ***"
+ @rm -f .conf_ok
+ifeq ($(LGW_PHY),native)
+ @echo "Selected SPI interface type: Linux native driver"
+else
+ifeq ($(LGW_PHY),ftdi)
+ @echo "Selected SPI interface type: FTDI SPI-over-USB bridge"
+else
+ $(error No SPI physical layer selected)
+endif
+endif
+ @echo "*** Config seems ok ***"
+ @echo ""
+ @touch .conf_ok
+
+# static library
+
+libloragw.a: obj/loragw_hal.o obj/loragw_reg.o obj/loragw_spi.o obj/loragw_aux.o
+ ar rcs libloragw.a obj/loragw_hal.o obj/loragw_reg.o obj/loragw_spi.o obj/loragw_aux.o
+
+# library module target
+
+obj/loragw_aux.o: .conf_ok src/loragw_aux.c inc/loragw_aux.h
+ $(CC) -c $(CFLAGS) src/loragw_aux.c -o obj/loragw_aux.o $(FLAG_AUX)
+
+obj/loragw_spi.o: .conf_ok src/loragw_spi.native.c src/loragw_spi.ftdi.c inc/loragw_spi.h
+ifeq ($(LGW_PHY),native)
+ $(CC) -c $(C99FLAGS) src/loragw_spi.native.c -o obj/loragw_spi.o $(FLAG_SPI)
+endif
+ifeq ($(LGW_PHY),ftdi)
+ $(CC) -c $(C99FLAGS) src/loragw_spi.ftdi.c -o obj/loragw_spi.o $(FLAG_SPI)
+endif
+
+obj/loragw_reg.o: .conf_ok src/loragw_reg.c inc/loragw_reg.h inc/loragw_spi.h
+ $(CC) -c $(C99FLAGS) src/loragw_reg.c -o obj/loragw_reg.o $(FLAG_REG)
+
+obj/loragw_hal.o: .conf_ok src/loragw_hal.c src/arb_fw.var src/agc_fw.var inc/loragw_hal.h inc/loragw_reg.h inc/loragw_spi.h inc/loragw_aux.h
+ $(CC) -c $(C99FLAGS) src/loragw_hal.c -o obj/loragw_hal.o -D LGW_PHY="\"$(LGW_PHY)\"" $(FLAG_HAL)
+
+# test programs
+
+test_loragw_spi: tst/test_loragw_spi.c obj/loragw_spi.o
+ $(CC) $(C99FLAGS) tst/test_loragw_spi.c obj/loragw_spi.o -o test_loragw_spi $(LDFLAGS)
+
+test_loragw_reg: tst/test_loragw_reg.c obj/loragw_reg.o obj/loragw_spi.o
+ $(CC) $(C99FLAGS) tst/test_loragw_reg.c obj/loragw_reg.o obj/loragw_spi.o -o test_loragw_reg $(LDFLAGS)
+
+test_loragw_hal: tst/test_loragw_hal.c obj/loragw_hal.o obj/loragw_reg.o obj/loragw_spi.o obj/loragw_aux.o
+ $(CC) $(C99FLAGS) tst/test_loragw_hal.c obj/loragw_hal.o obj/loragw_reg.o obj/loragw_spi.o obj/loragw_aux.o -o test_loragw_hal $(LDFLAGS)
+