summaryrefslogtreecommitdiff
path: root/unix/Makefile
blob: 0e27cc1caeda59329e57bf3220fd30ee57999e84 (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

#########################################################################
#
#  $Id: Makefile 1.4 2011/04/18 08:08:41 martin REL_M $
#
#  Description:
#    Makefile for gpsxmple for Unix-like systems.
#    Currently supported OSs: Linux, QNX 6.x
#
# -----------------------------------------------------------------------
#  $Log: Makefile $
#  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_COMMON=$(MBGLIB)/common
LOC_INCL = -I. -I $(MBGLIB_COMMON)


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


# set up the compiler flags

CFLAGS = -Wall

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

CFLAGS += $(LOC_INCL)
CFLAGS += -D_USE_SOCKET_IO=1

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


SRCS=../$(TARGET).c \
  $(MBGLIB_COMMON)/mbgextio.c \
  $(MBGLIB_COMMON)/mbgserio.c \
  $(MBGLIB_COMMON)/gpsserio.c \
  $(MBGLIB_COMMON)/gpsutils.c \
  $(MBGLIB_COMMON)/aes128.c


.PHONY: all
all: $(TARGET)

$(TARGET): $(SRCS) $(MAKEFILE_LIST)
	$(CC) $(CFLAGS) $(SRCS) -o $@


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

.PHONY: distclean
distclean: clean