summaryrefslogtreecommitdiff
path: root/unix/Makefile
blob: 9b856d69040551fd67a3cad876149c65d1afce39 (plain)
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107

#########################################################################
#
#  $Id: Makefile 1.9 2017/04/12 08:49:33 martin TEST $
#
#  Description:
#    Makefile for gpsxmple for Unix-like systems.
#    Currently supported OSs: Linux, QNX 6.x
#
# -----------------------------------------------------------------------
#  $Log: Makefile $
#  Revision 1.9  2017/04/12 08:49:33  martin
#  Changed CFLAGS to CPPFLAGS.
#  Revision 1.8  2017/04/05 16:08:53  martin
#  Added some library modules.
#  Revision 1.7  2014/10/30 13:50:04  martin
#  Added module mbgerror.o.
#  Revision 1.6  2013/02/01 16:11:27  martin
#  Added extiohlp module to the list of object files.
#  Revision 1.5  2011/08/19 07:26:40  martin
#  Modified the way to define targets etc.
#  Revision 1.4  2011/04/18 08:08:41  martin
#  Modified DEBUG handling.
#  Revision 1.3  2009/10/01 14:09:19  martin
#  Added mbgserio.c source module.
#  Revision 1.2  2006/08/22 15:49:27  martin
#  Moved this makefile for Unix-like systems to folder unix.
#  This build environment now supports Linux and QNX 6.x.
#  Network socket I/O is supported for both Linux and QNX.
#  Serial I/O is not yet supprted for QNX, but for Linux.
#  Account for mbglib files having been moved to subdirectory mbglib.
#  Build with debug if make is called with DEBUG=1.
#  Added library modules mbgextio.c and aes128.c.
#  Revision 1.1  2004/06/01 14:55:27  martin
#
#########################################################################

TARGET = gpsxmple

MBGLIB = ../mbglib
MBGLIB_DIRS += common

VPATH += ..
VPATH += $(foreach dir,$(MBGLIB_DIRS),$(MBGLIB)/$(dir))

OBJS = $(TARGET).o
OBJS += extiohlp.o
OBJS += xtiocomm.o
OBJS += cfg_hlp.o
OBJS += mbgextio.o
OBJS += mbgserio.o
OBJS += gpsserio.o
OBJS += gpsutils.o
OBJS += aes128.o
OBJS += mbgerror.o
OBJS += str_util.o
OBJS += lan_util.o
OBJS += xdevfeat.o

# Try to determine whether the OS is QNX
OS_IS_QNX := $(shell uname | grep -i QNX && echo "QNX" )


# set up the compiler flags

CPPFLAGS += -Wall

ifdef DEBUG
  # build with debugging enabled
  CPPFLAGS += -g -DDEBUG=$(DEBUG)
else
  # build with specified optimization level
  CPPFLAGS += -O2
endif

CPPFLAGS += -D_USE_SOCKET_IO=1

CPPFLAGS += -I.
CPPFLAGS += $(foreach dir,$(MBGLIB_DIRS),-I$(MBGLIB)/$(dir))

ifneq ($(OS_IS_QNX),)
  # for QNX we must link the socket library explicitely
  LDFLAGS += -lsocket
  # we don't yet support serial I/O under QNX
  CPPFLAGS += -D_USE_SERIAL_IO=0
else
  CPPFLAGS += -D_USE_SERIAL_IO=1
endif


LD = $(CC)

.PHONY: all
all: $(TARGET)

$(TARGET): $(OBJS)
	$(LD) $(LDFLAGS) -o $@ $(OBJS)


.PHONY: clean
clean:
	rm -f *.o *~ core
	rm -f $(TARGET)

.PHONY: distclean
distclean: clean