Host driver/HAL to build a LoRa Picocell Gateway which communicates through USB with a concentrator board based on Semtech SX1308 multi-channel modem and SX1257/SX1255 RF transceivers.
libloragw/Makefile@0:102b50f941d0, 2018-04-11 (annotated)
- Committer:
- dgabino
- Date:
- Wed Apr 11 14:38:42 2018 +0000
- Revision:
- 0:102b50f941d0
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dgabino | 0:102b50f941d0 | 1 | ### get external defined data |
dgabino | 0:102b50f941d0 | 2 | |
dgabino | 0:102b50f941d0 | 3 | LIBLORAGW_VERSION := `cat ../VERSION` |
dgabino | 0:102b50f941d0 | 4 | include library.cfg |
dgabino | 0:102b50f941d0 | 5 | |
dgabino | 0:102b50f941d0 | 6 | ### constant symbols |
dgabino | 0:102b50f941d0 | 7 | |
dgabino | 0:102b50f941d0 | 8 | ARCH ?= |
dgabino | 0:102b50f941d0 | 9 | CROSS_COMPILE ?= |
dgabino | 0:102b50f941d0 | 10 | CC := $(CROSS_COMPILE)gcc |
dgabino | 0:102b50f941d0 | 11 | AR := $(CROSS_COMPILE)ar |
dgabino | 0:102b50f941d0 | 12 | |
dgabino | 0:102b50f941d0 | 13 | CFLAGS := -O2 -Wall -Wextra -std=c99 -Iinc -I. |
dgabino | 0:102b50f941d0 | 14 | |
dgabino | 0:102b50f941d0 | 15 | OBJDIR = obj |
dgabino | 0:102b50f941d0 | 16 | INCLUDES = $(wildcard inc/*.h) |
dgabino | 0:102b50f941d0 | 17 | |
dgabino | 0:102b50f941d0 | 18 | ### linking options |
dgabino | 0:102b50f941d0 | 19 | |
dgabino | 0:102b50f941d0 | 20 | LIBS := -lloragw -lrt -lm |
dgabino | 0:102b50f941d0 | 21 | |
dgabino | 0:102b50f941d0 | 22 | ### general build targets |
dgabino | 0:102b50f941d0 | 23 | |
dgabino | 0:102b50f941d0 | 24 | all: libloragw.a test_loragw_reg test_loragw_hal test_loragw_cal |
dgabino | 0:102b50f941d0 | 25 | |
dgabino | 0:102b50f941d0 | 26 | clean: |
dgabino | 0:102b50f941d0 | 27 | rm -f libloragw.a |
dgabino | 0:102b50f941d0 | 28 | rm -f test_loragw_* |
dgabino | 0:102b50f941d0 | 29 | rm -f $(OBJDIR)/*.o |
dgabino | 0:102b50f941d0 | 30 | rm -f inc/config.h |
dgabino | 0:102b50f941d0 | 31 | |
dgabino | 0:102b50f941d0 | 32 | ### transpose library.cfg into a C header file : config.h |
dgabino | 0:102b50f941d0 | 33 | |
dgabino | 0:102b50f941d0 | 34 | inc/config.h: ../VERSION library.cfg |
dgabino | 0:102b50f941d0 | 35 | @echo "*** Checking libloragw library configuration ***" |
dgabino | 0:102b50f941d0 | 36 | @rm -f $@ |
dgabino | 0:102b50f941d0 | 37 | #File initialization |
dgabino | 0:102b50f941d0 | 38 | @echo "#ifndef _LORAGW_CONFIGURATION_H" >> $@ |
dgabino | 0:102b50f941d0 | 39 | @echo "#define _LORAGW_CONFIGURATION_H" >> $@ |
dgabino | 0:102b50f941d0 | 40 | # Release version |
dgabino | 0:102b50f941d0 | 41 | @echo "Release version : $(LIBLORAGW_VERSION)" |
dgabino | 0:102b50f941d0 | 42 | @echo " #define LIBLORAGW_VERSION "\"$(LIBLORAGW_VERSION)\""" >> $@ |
dgabino | 0:102b50f941d0 | 43 | # Debug options |
dgabino | 0:102b50f941d0 | 44 | @echo " #define DEBUG_AUX $(DEBUG_AUX)" >> $@ |
dgabino | 0:102b50f941d0 | 45 | @echo " #define DEBUG_COM $(DEBUG_COM)" >> $@ |
dgabino | 0:102b50f941d0 | 46 | @echo " #define DEBUG_REG $(DEBUG_REG)" >> $@ |
dgabino | 0:102b50f941d0 | 47 | @echo " #define DEBUG_MCU $(DEBUG_MCU)" >> $@ |
dgabino | 0:102b50f941d0 | 48 | @echo " #define DEBUG_HAL $(DEBUG_HAL)" >> $@ |
dgabino | 0:102b50f941d0 | 49 | # end of file |
dgabino | 0:102b50f941d0 | 50 | @echo "#endif" >> $@ |
dgabino | 0:102b50f941d0 | 51 | @echo "*** Configuration seems ok ***" |
dgabino | 0:102b50f941d0 | 52 | |
dgabino | 0:102b50f941d0 | 53 | ### library module target |
dgabino | 0:102b50f941d0 | 54 | |
dgabino | 0:102b50f941d0 | 55 | $(OBJDIR): |
dgabino | 0:102b50f941d0 | 56 | mkdir -p $(OBJDIR) |
dgabino | 0:102b50f941d0 | 57 | |
dgabino | 0:102b50f941d0 | 58 | $(OBJDIR)/%.o: src/%.c $(INCLUDES) inc/config.h | $(OBJDIR) |
dgabino | 0:102b50f941d0 | 59 | $(CC) -c $(CFLAGS) $< -o $@ |
dgabino | 0:102b50f941d0 | 60 | |
dgabino | 0:102b50f941d0 | 61 | $(OBJDIR)/loragw_com_linux.o: src/loragw_com_linux.c $(INCLUDES) inc/config.h | $(OBJDIR) |
dgabino | 0:102b50f941d0 | 62 | $(CC) -c $(CFLAGS) $< -o $@ |
dgabino | 0:102b50f941d0 | 63 | |
dgabino | 0:102b50f941d0 | 64 | $(OBJDIR)/loragw_com.o: src/loragw_com.c $(INCLUDES) inc/config.h | $(OBJDIR) |
dgabino | 0:102b50f941d0 | 65 | $(CC) -c $(CFLAGS) $< -o $@ |
dgabino | 0:102b50f941d0 | 66 | |
dgabino | 0:102b50f941d0 | 67 | $(OBJDIR)/loragw_mcu.o: src/loragw_mcu.c $(INCLUDES) inc/config.h | $(OBJDIR) |
dgabino | 0:102b50f941d0 | 68 | $(CC) -c $(CFLAGS) $< -o $@ |
dgabino | 0:102b50f941d0 | 69 | |
dgabino | 0:102b50f941d0 | 70 | $(OBJDIR)/loragw_hal.o: src/loragw_hal.c $(INCLUDES) src/arb_fw.var src/agc_fw.var src/cal_fw.var inc/config.h | $(OBJDIR) |
dgabino | 0:102b50f941d0 | 71 | $(CC) -c $(CFLAGS) $< -o $@ |
dgabino | 0:102b50f941d0 | 72 | |
dgabino | 0:102b50f941d0 | 73 | ### static library |
dgabino | 0:102b50f941d0 | 74 | |
dgabino | 0:102b50f941d0 | 75 | libloragw.a: $(OBJDIR)/loragw_hal.o $(OBJDIR)/loragw_mcu.o $(OBJDIR)/loragw_reg.o $(OBJDIR)/loragw_com.o $(OBJDIR)/loragw_com_linux.o $(OBJDIR)/loragw_aux.o $(OBJDIR)/loragw_radio.o |
dgabino | 0:102b50f941d0 | 76 | $(AR) rcs $@ $^ |
dgabino | 0:102b50f941d0 | 77 | |
dgabino | 0:102b50f941d0 | 78 | ### test programs |
dgabino | 0:102b50f941d0 | 79 | |
dgabino | 0:102b50f941d0 | 80 | test_loragw_com: tst/test_loragw_com.c libloragw.a |
dgabino | 0:102b50f941d0 | 81 | $(CC) $(CFLAGS) -L. $< -o $@ $(LIBS) |
dgabino | 0:102b50f941d0 | 82 | |
dgabino | 0:102b50f941d0 | 83 | test_loragw_reg: tst/test_loragw_reg.c libloragw.a |
dgabino | 0:102b50f941d0 | 84 | $(CC) $(CFLAGS) -L. $< -o $@ $(LIBS) |
dgabino | 0:102b50f941d0 | 85 | |
dgabino | 0:102b50f941d0 | 86 | test_loragw_hal: tst/test_loragw_hal.c libloragw.a |
dgabino | 0:102b50f941d0 | 87 | $(CC) $(CFLAGS) -L. $< -o $@ $(LIBS) |
dgabino | 0:102b50f941d0 | 88 | |
dgabino | 0:102b50f941d0 | 89 | test_loragw_gps: tst/test_loragw_gps.c libloragw.a |
dgabino | 0:102b50f941d0 | 90 | $(CC) $(CFLAGS) -L. $< -o $@ $(LIBS) |
dgabino | 0:102b50f941d0 | 91 | |
dgabino | 0:102b50f941d0 | 92 | test_loragw_cal: tst/test_loragw_cal.c libloragw.a src/cal_fw.var |
dgabino | 0:102b50f941d0 | 93 | $(CC) $(CFLAGS) -L. $< -o $@ $(LIBS) |
dgabino | 0:102b50f941d0 | 94 | |
dgabino | 0:102b50f941d0 | 95 | ### EOF |