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
- Committer:
- dgabino
- Date:
- 2018-04-11
- Revision:
- 0:102b50f941d0
File content as of revision 0:102b50f941d0:
### get external defined data LIBLORAGW_VERSION := `cat ../VERSION` include library.cfg ### constant symbols ARCH ?= CROSS_COMPILE ?= CC := $(CROSS_COMPILE)gcc AR := $(CROSS_COMPILE)ar CFLAGS := -O2 -Wall -Wextra -std=c99 -Iinc -I. OBJDIR = obj INCLUDES = $(wildcard inc/*.h) ### linking options LIBS := -lloragw -lrt -lm ### general build targets all: libloragw.a test_loragw_reg test_loragw_hal test_loragw_cal clean: rm -f libloragw.a rm -f test_loragw_* rm -f $(OBJDIR)/*.o rm -f inc/config.h ### transpose library.cfg into a C header file : config.h inc/config.h: ../VERSION library.cfg @echo "*** Checking libloragw library configuration ***" @rm -f $@ #File initialization @echo "#ifndef _LORAGW_CONFIGURATION_H" >> $@ @echo "#define _LORAGW_CONFIGURATION_H" >> $@ # Release version @echo "Release version : $(LIBLORAGW_VERSION)" @echo " #define LIBLORAGW_VERSION "\"$(LIBLORAGW_VERSION)\""" >> $@ # Debug options @echo " #define DEBUG_AUX $(DEBUG_AUX)" >> $@ @echo " #define DEBUG_COM $(DEBUG_COM)" >> $@ @echo " #define DEBUG_REG $(DEBUG_REG)" >> $@ @echo " #define DEBUG_MCU $(DEBUG_MCU)" >> $@ @echo " #define DEBUG_HAL $(DEBUG_HAL)" >> $@ # end of file @echo "#endif" >> $@ @echo "*** Configuration seems ok ***" ### library module target $(OBJDIR): mkdir -p $(OBJDIR) $(OBJDIR)/%.o: src/%.c $(INCLUDES) inc/config.h | $(OBJDIR) $(CC) -c $(CFLAGS) $< -o $@ $(OBJDIR)/loragw_com_linux.o: src/loragw_com_linux.c $(INCLUDES) inc/config.h | $(OBJDIR) $(CC) -c $(CFLAGS) $< -o $@ $(OBJDIR)/loragw_com.o: src/loragw_com.c $(INCLUDES) inc/config.h | $(OBJDIR) $(CC) -c $(CFLAGS) $< -o $@ $(OBJDIR)/loragw_mcu.o: src/loragw_mcu.c $(INCLUDES) inc/config.h | $(OBJDIR) $(CC) -c $(CFLAGS) $< -o $@ $(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) $(CC) -c $(CFLAGS) $< -o $@ ### static library 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 $(AR) rcs $@ $^ ### test programs test_loragw_com: tst/test_loragw_com.c libloragw.a $(CC) $(CFLAGS) -L. $< -o $@ $(LIBS) test_loragw_reg: tst/test_loragw_reg.c libloragw.a $(CC) $(CFLAGS) -L. $< -o $@ $(LIBS) test_loragw_hal: tst/test_loragw_hal.c libloragw.a $(CC) $(CFLAGS) -L. $< -o $@ $(LIBS) test_loragw_gps: tst/test_loragw_gps.c libloragw.a $(CC) $(CFLAGS) -L. $< -o $@ $(LIBS) test_loragw_cal: tst/test_loragw_cal.c libloragw.a src/cal_fw.var $(CC) $(CFLAGS) -L. $< -o $@ $(LIBS) ### EOF