Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 2660e8a1d5
Fetching contributors…

Cannot retrieve contributors at this time

file 179 lines (145 sloc) 3.978 kb
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 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179
# -*- makefile -*-
VERSION:=${shell cat VERSION}

#CXX:=g++-fsf-4.4 -m32

CXXFLAGS :=
#CXXFLAGS += -O3 -funroll-loops -fexpensive-optimizations -DNDEBUG
#CXXFLAGS += -ffast-math

#CXXFLAGS := -g3 -O0 -m32
CXXFLAGS :=

WARN := -Wall
WARN += -Wimplicit
#WARN += -pedantic # long long
WARN += -W
WARN += -Wredundant-decls
#WARN += -Werror
WARN += -Wmissing-prototypes
WARN += -Wunknown-pragmas
WARN += -Wunused
WARN += -Wunused
WARN += -Wendif-labels
WARN += -Wnewline-eof
WARN += -Wno-sign-compare
WARN += -Wshadow
# Requires -O
WARN += -O -Wuninitialized

# Disabled warnings
#WARN+= -Weffc++
#WARN+= -Wunreachable-code

DEBUG:= -g3 -DDEBUG=1
#DEBUG+= -O0
#DEBUG+= -O
# DEBUG+= -D_GLIBCXX_DEBUG # Bad things on the mac? May be a gtest bug.
DEBUG+= -D_GLIBCXX_DEBUG_PEDANTIC -D_GLIBCPP_CONCEPT_CHECKS

OPT:= -O3 -funroll-loops -fexpensive-optimizations -ffast-math
OPT+= -DNDEBUG

ifdef OPTIMIZE
  CXXFLAGS += ${OPT}
else
  CXXFLAGS += ${DEBUG}
endif


CXXFLAGS += ${WARN}

#CFLAGS := ${CXXFLAGS}

SRCS := ais.cpp
SRCS += ais1_2_3.cpp ais4_11.cpp ais5.cpp ais7_13.cpp

SRCS += ais8.cpp

# IMO Messages - Circ 289
SRCS += ais8_001_22.cpp # Area notice

# US Specific Messages
SRCS += ais8_366_22.cpp

#
SRCS += ais9.cpp ais10.cpp ais12.cpp
SRCS += ais14.cpp
#
SRCS += ais18.cpp ais19.cpp
#
SRCS += ais21.cpp
#
SRCS += ais24.cpp
OBJS := ${SRCS:.cpp=.o}

default:
@echo
@echo
@echo " Welcome to libais ${VERSION}"
@echo
@echo "Build options:"
@echo
@echo " clean - remove all objects and executables"
@echo " all - build everything"
@echo " tar - create a release source tar using VERSION"
@echo
@echo " python - build the python module"
@echo " libais.a - build a static archive library"
@echo " test_libais - Simple C++ library test"
@echo " python2 - build the python2.6 module"
@echo " python3 - build the python3.1 module"
@echo " nais2pg - Run the python 2.6 nais2pg.py program"
@echo
@echo "Read the README for more information"

all: python2 python3 libais.a test_libais
./test_libais

#ais.h: ais.h.in
# rm -f ais.h
# cmake -G "Unix Makefiles"

nais2pg:
make clean
make python2
PYTHONPATH=build/lib.macosx-10.6-i386-2.6 ./nais2pg.py -v -I datalogger1.ccom.nh

DIST:=libais-${shell cat VERSION}
TAR:=${DIST}.tar
tar:
rm -f ${TAR}.bz2 ${TAR}
rm -rf ${DIST}
mkdir ${DIST}
cp -p *.cpp *.h [A-Z]* *.py ${DIST}/
tar cf ${TAR} ${DIST}
bzip2 -9 ${TAR}
rm -rf ${DIST}


# Remove the NDEBUG that python tries to use
python2:
CFLAGS="-m32 -O3 -funroll-loops -fexpensive-optimizations -ffast-math" /sw/bin/python2.7 setup.py build
# CFLAGS="-m32 -O0 -g -UNDEBUG" /sw/bin/python2.6 setup.py build

# -D_GLIBCXX_DEBUG This option does not seem to work for g++ versions 4.[0-2]
python3:
CFLAGS="-m32 -O0 -g -UNDEBUG" /sw/bin/python3 setup.py build

libais.a: ${OBJS}
ls ${OBJS}
ar rv $@ $?
ranlib $@

clean:
-rm -rf *.o build *.a *.pyc test_libais
-rm -rf *.d *_unittest *.dSYM

#.cpp.o:
# ${CXX} -c $< ${CXXFLAGS}

test: test_libais
./test_libais

test_libais: ${OBJS} test_libais.cpp ais.h
@echo SRCS: ${SRCS}
@echo OBJS: ${OBJS}
${CXX} -o $@ ${OBJS} test_libais.cpp ${CXXFLAGS}

ais_decode_normed: ${OBJS} ais_decode_normed.o ais.h
@echo SRCS: ${SRCS}
@echo OBJS: ${OBJS}
${CXX} -o $@ ${OBJS} ais_decode_normed.o ${CXXFLAGS}

# Hard coded depends
ais.o: ais.h
ais123.o: ais.h
ais4_11.o: ais.h
ais5.o: ais.h
ais7_13.o: ais.h
ais8_001_22.o: ais.h
ais14.o: ais.h
ais18.o: ais.h
ais19.o: ais.h
ais_py.o: ais.h
test_libais.o: ais.h

test2: ais1_2_3_unittest ais8_001_22_unittest
#ais8_001_22_unittest

FINK:=/sw32
#LDFLAGS:=-L${FINK}/lib
GTESTFLAGS := ${shell gtest-config --cppflags --cxxflags --ldflags --libs}
ais8_001_22_unittest: ais8_001_22_unittest.cpp ais8_001_22.cpp ais.cpp ais8.cpp
${CXX} -m32 -g ${WARN} $^ -o $@ ${GTESTFLAGS} -lgtest_main -lpthread
./$@

ais1_2_3_unittest: ais1_2_3_unittest.cpp ais.cpp ais1_2_3.cpp
${CXX} -m32 -g ${WARN} $^ -o $@ ${GTESTFLAGS} -lgtest_main -lpthread
./$@
Something went wrong with that request. Please try again.