summaryrefslogtreecommitdiff
path: root/lora_pkt_fwd/Makefile
diff options
context:
space:
mode:
authorHarsh Sharma <92harshsharma@gmail.com>2018-06-13 13:26:38 -0500
committerHarsh Sharma <92harshsharma@gmail.com>2018-06-13 13:26:38 -0500
commit2a02a3a7dfda2679ebda86fa830023fe996a06c9 (patch)
tree96aee456765756759d04e59361ae07726b053e24 /lora_pkt_fwd/Makefile
downloadpacket_forwarder_mtac_full-2a02a3a7dfda2679ebda86fa830023fe996a06c9.tar.gz
packet_forwarder_mtac_full-2a02a3a7dfda2679ebda86fa830023fe996a06c9.tar.bz2
packet_forwarder_mtac_full-2a02a3a7dfda2679ebda86fa830023fe996a06c9.zip
Initial commit
Diffstat (limited to 'lora_pkt_fwd/Makefile')
-rw-r--r--lora_pkt_fwd/Makefile67
1 files changed, 67 insertions, 0 deletions
diff --git a/lora_pkt_fwd/Makefile b/lora_pkt_fwd/Makefile
new file mode 100644
index 0000000..1330d62
--- /dev/null
+++ b/lora_pkt_fwd/Makefile
@@ -0,0 +1,67 @@
+### Application-specific constants
+
+APP_NAME := lora_pkt_fwd
+
+### Environment constants
+
+LGW_PATH ?= ../../lora_gateway/libloragw
+ARCH ?=
+CROSS_COMPILE ?=
+
+OBJDIR = obj
+INCLUDES = $(wildcard inc/*.h)
+
+### External constant definitions
+# must get library build option to know if mpsse must be linked or not
+
+include $(LGW_PATH)/library.cfg
+RELEASE_VERSION := `cat ../VERSION`
+
+### Constant symbols
+
+CC := $(CROSS_COMPILE)gcc
+AR := $(CROSS_COMPILE)ar
+
+CFLAGS := -O2 -Wall -Wextra -std=c99 -Iinc -I.
+VFLAG := -D VERSION_STRING="\"$(RELEASE_VERSION)\""
+
+### Constants for Lora concentrator HAL library
+# List the library sub-modules that are used by the application
+
+LGW_INC =
+ifneq ($(wildcard $(LGW_PATH)/inc/config.h),)
+ # only for HAL version 1.3 and beyond
+ LGW_INC += $(LGW_PATH)/inc/config.h
+endif
+LGW_INC += $(LGW_PATH)/inc/loragw_hal.h
+LGW_INC += $(LGW_PATH)/inc/loragw_gps.h
+
+### Linking options
+
+LIBS := -lloragw -lrt -lpthread -lm
+
+### General build targets
+
+all: $(APP_NAME)
+
+clean:
+ rm -f $(OBJDIR)/*.o
+ rm -f $(APP_NAME)
+
+### Sub-modules compilation
+
+$(OBJDIR):
+ mkdir -p $(OBJDIR)
+
+$(OBJDIR)/%.o: src/%.c $(INCLUDES) | $(OBJDIR)
+ $(CC) -c $(CFLAGS) -I$(LGW_PATH)/inc $< -o $@
+
+### Main program compilation and assembly
+
+$(OBJDIR)/$(APP_NAME).o: src/$(APP_NAME).c $(LGW_INC) $(INCLUDES) | $(OBJDIR)
+ $(CC) -c $(CFLAGS) $(VFLAG) -I$(LGW_PATH)/inc $< -o $@
+
+$(APP_NAME): $(OBJDIR)/$(APP_NAME).o $(LGW_PATH)/libloragw.a $(OBJDIR)/parson.o $(OBJDIR)/base64.o $(OBJDIR)/jitqueue.o $(OBJDIR)/timersync.o
+ $(CC) -L$(LGW_PATH) $< $(OBJDIR)/parson.o $(OBJDIR)/base64.o $(OBJDIR)/jitqueue.o $(OBJDIR)/timersync.o -o $@ $(LIBS)
+
+### EOF