NSIS-ka
A free C++ implementation of NSIS protocols

source: ntlp/branches/20081127-merge-mobility-mk3/src/Makefile @ 4560

Last change on this file since 4560 was 4180, checked in by bless, 8 years ago
  • MAKEFLAGS removed because they are automatically passed
  • Property svn:keywords set to URL Rev Author
File size: 8.3 KB
Line 
1# -----------------------------------*- mode: Makefile; -*--
2# Makefile - Makefile for GIST/NTLP
3# ----------------------------------------------------------
4# $Id$
5# $HeadURL: ntlp/branches/20081127-merge-mobility-mk3/src/Makefile $
6# ==========================================================
7#                     
8# (C)opyright, all rights reserved by
9# - Institute of Telematics, University of Karlsruhe (TH)
10# ==========================================================
11#
12# The following Makefile variables may be used:
13#     LOGGING        Enable logging output (default: active)
14#     DEBUGGING      Enable debugging (default: active)
15#     OPTIMIZATION   Optimize using the given flags (default: '')
16#
17# Don't forget to run "make clean" before changing these variables!
18# An example for building without debugging but with logging support and
19# optimization:
20#
21#     make DEBUGGING= LOGGING=1 OPTIMIZATION=-O2
22#
23
24DISTDIR?=$(CURDIR)/../..
25include $(DISTDIR)/Makefile.inc
26
27DEBUGGING       = 1                     # the undefined value disables debugging
28LOGGING         = 1                     # the undefined value disables logging
29OPTIMIZATION    =                       # ie. -O2
30
31ifdef DEBUGGING
32GIST_CXXFLAGS   += -g -D_DEBUG
33endif
34
35ifndef LOGGING
36GIST_CXXFLAGS   += -D_NO_LOGGING
37endif
38
39GIST_CXXFLAGS   += $(OPTIMIZATION)
40
41
42
43#SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/)
44#ARCH := $(SUBARCH)
45
46#export UNAME_MACHINE := "$(ARCH)"
47
48include ../GIST-KA-RELEASE
49
50#CFLAGS         = -pg -Wuninitialized -Wall $(GIST_CXXFLAGS) # profiling
51#CFLAGS         = -s -finline-functions -O3 -Wuninitialized -Wall $(GIST_CXXFLAGS) # optimization
52#CFLAGS         = --pedantic -O -Wno-long-long -Wuninitialized -Wall $(GIST_CXXFLAGS) # optimized
53#CFLAGS         = --pedantic -g -Wno-long-long -Wall $(GIST_CXXFLAGS) # development
54#CFLAGS         = --pedantic -O2 -g -Wno-long-long -Wall $(GIST_CXXFLAGS) # development (valgrind)
55CFLAGS          = --pedantic -Wno-long-long -Wall $(GIST_CXXFLAGS) -D GIST_VSTR=\"$(GIST_RELEASE)\"
56CFLAGS         += -Wno-deprecated -Werror
57
58CLINK           = -c -o
59CC              = gcc
60CPP             = g++
61RM              = rm -f
62
63NTLPEXE         = gistka
64
65TARGETS = $(NTLPEXE) test_objectpool libs
66
67PDUDIR=pdu
68
69NTLP_PDUSRC  := $(wildcard $(PDUDIR)/*.cpp)
70NTLP_PDUOBJS := $(patsubst %.cpp,%.o,$(NTLP_PDUSRC))
71
72TMP_NTLP_SRCS =  $(wildcard *.cpp) $(NTLP_PDUSRC)
73ifndef USE_FLOWINFO
74NTLP_SRCS = $(filter-out flowinfo.cpp, $(TMP_NTLP_SRCS))
75else
76NTLP_SRCS = $(TMP_NTLP_SRCS)
77CFLAGS += $(FLOWINFO_CFLAGS)
78endif
79NTLP_ALLOBJS=  $(patsubst %.cpp,%.o,$(NTLP_SRCS))
80NTLP_OBJS=  $(filter-out $(NTLP_MAIN_OBJ),$(NTLP_ALLOBJS))
81
82
83DEPENDFILE := $(wildcard dependfile)
84
85GISTLIB=libGIST.a
86GISTLIB_SHARED=libGIST.so
87
88ifdef SCTP_DIR
89GNOME_LIBDIR    = /opt/gnome/lib
90SCTP_INC        = $(SCTP_DIR)/sctplib/sctp
91SCTP_INCLUDE    = -I$(SCTP_INC)
92SCTP_LIBDIR     = $(SCTP_DIR)/sctplib/sctp/.libs
93SCTP_LIB        = $(SCTP_LIBDIR)/libsctplib.a
94SCTP_LIBSEARCH  = -L$(SCTP_LIBDIR) -L$(GNOME_LIBDIR)
95SCTP_LIBLD      = -lsctplib -lgtk -lgdk
96SCTP_OPTIONS    = -D_USE_SCTP
97CFLAGS          += $(SCTP_OPTIONS)
98PROTLIB_MAKEFLAGS += SCTP_DIR=$(SCTP_DIR)
99endif
100
101ifdef SCTP_KERN
102SCTP_LIBLD      = -lsctp
103SCTP_OPTIONS    = -D_USE_SCTP
104CFLAGS          += $(SCTP_OPTIONS)
105PROTLIB_MAKEFLAGS += SCTP_KERN=yo
106endif
107
108# QT_DIR=/usr/lib/qt3
109ifdef QT_DIR
110GUI_OPTIONS     = -D_GUI
111GUI_QTINC       = $(QT_DIR)/include
112GUI_INC         = gui/include
113GUI_SRCDIR      = gui/src
114GUI_INCLUDE     = -I$(GUI_INC) -I$(GUI_QTINC)
115GUI_QTLIBDIR      = $(QT_DIR)/lib
116GUI_LIBSEARCH   = -L$(GUI_QTLIBDIR)
117CFLAGS          += $(GUI_OPTIONS)
118QTLIBFLAG               = -lqt
119endif
120
121LIBS            = $(PROTLIB_LIB) $(FQUEUE_LIB) $(SCTP_LIB) # use with SCTP
122#LIBS           = $(PROTLIB_LIB) $(FQUEUE_LIB)
123
124# librt is required for POSIX threads
125SHLIBS          = -lrt $(QTLIBFLAG)
126STATIC_LIBS     = $(LD_PROTLIB_LIB) -lipq -lssl $(LD_FQUEUE_LIB) $(SCTP_LIBLD)
127
128API_INC         = ../include
129PDU_INC         = ./pdu
130INCLUDE         = -I. -I$(PDU_INC) -I$(API_INC) -I$(PROTLIB_INC) -I$(FQUEUE_INC) $(SCTP_INCLUDE) $(GUI_INCLUDE)
131LIBDIRS                = -L$(FQUEUE_SRC) -L$(PROTLIB_SRC) $(SCTP_LIBSEARCH) $(GUI_LIBSEARCH)
132
133SUBDIRS = $(PROTLIB_SRC)
134
135.SUFFIXES:      .cpp
136
137
138
139.DEFAULT:
140        @echo "** Oops, now I'm in trouble, because..."
141        @echo "=> Don't know how to make target $<."
142        @echo
143        @echo "HINT: If it's a header file, you may try \"make depend\"".
144        @echo "      Otherwise have a look at"
145        @echo "      `pwd`/Makefile"
146        @false
147
148## ----------------------------------------------------------------------------------------------
149
150all:    protliblib $(GISTLIB) $(NTLPEXE)
151 
152.PHONY: all protliblib
153
154setperms:
155        test -x test_setuid && su -c 'chown root test_setuid ; chmod u+s test_setuid' ; true
156#       test -x test_tp_over_sctp && su -c 'chown root test_tp_over_sctp ; chmod u+s test_tp_over_sctp' ; true
157        test -x test_signaling && su -c 'chown root test_signaling ; chmod u+s test_signaling' ; true
158        test -x simpleclient && su -c 'chown root simpleclient ; chmod u+s simpleclient' ; true
159
160$(NTLPEXE):   $(NTLP_MAIN_OBJ) $(GISTLIB) $(LIBS)
161        $(CPP) $(CFLAGS) -o $@ $(NTLP_MAIN_OBJ) -L . -lGIST $(LIBDIRS) $(SHLIBS) $(STATIC_LIBS) 
162
163$(GISTLIB): $(NTLP_OBJS)
164        ar -rsv $@ $?
165
166$(GISTLIB_SHARED): $(NTLP_OBJS)
167        $(CPP) -shared -o $@ $?
168
169test_flowinfo: test_flowinfo.o $(GISTLIB) $(LIBS)
170        $(CPP) $(CFLAGS) -o $@ $^  -L . -lGIST $(LIBDIRS) $(SHLIBS) $(STATIC_LIBS)
171
172simpleclient: simpleclient.o
173        $(CPP) $(CFLAGS) -o $@ $^ $(LIBDIRS) $(SHLIBS) $(STATIC_LIBS)
174
175test_api_send: test_api_send.o
176        $(CPP) $(CFLAGS) -o $@ $(NTLP_OBJS) $^ $(LIBDIRS) $(SHLIBS) $(STATIC_LIBS)
177
178simpleclientUDPdummy: simpleclientUDPdummy.o
179        $(CPP) $(CFLAGS) -o $@ $(NTLP_OBJS) $^ $(LIBDIRS) $(SHLIBS) $(STATIC_LIBS)
180
181
182simpleclientQE: simpleclientQE.o
183        $(CPP) $(CFLAGS) -o $@ $^ $(LIBDIRS) $(SHLIBS) $(STATIC_LIBS)
184
185simpleclientNTLP: simpleclientNTLP.o
186        $(CPP) $(CFLAGS) -o $@ $(NTLP_OBJS) $^ $(LIBDIRS) $(SHLIBS) $(STATIC_LIBS)
187
188
189tests: libs test_log test_objectpool test_timer test_threads test_refcount\
190        test_ie test_fqueue test_timer_module test_setuid test_tp_over_tcp\
191        test_prefixmap test_signaling
192
193test_log: test_log.o logfile.o
194        $(CPP) $(CFLAGS) -o $@ $^ $(SHLIBS)
195
196test_prefixmap: test_prefixmap.o threadsafe_db.o logfile.o libie.a
197        $(CPP) $(CFLAGS) -o $@ $^ $(SHLIBS)
198
199test_objectpool: test_objectpool.o test_util.o objectpool.o logfile.o # fqueue.o $(FQUEUE_LIB)
200        $(CPP) $(CFLAGS) -o $@ $^ $(SHLIBS)
201
202test_fqueue: test_fqueue.o test_util.o fqueue.o logfile.o $(FQUEUE_LIB)
203        $(CPP) $(CFLAGS) -o $@ $^ $(SHLIBS)
204
205test_timer: test_timer.o timer.o logfile.o # fqueue.o $(FQUEUE_LIB)
206        $(CPP) $(CFLAGS) -o $@ $^ $(SHLIBS)
207
208test_threads: test_threads.o threads.o logfile.o # fqueue.o $(FQUEUE_LIB)
209        $(CPP) $(CFLAGS) -o $@ $^ $(SHLIBS)
210
211test_refcount: test_refcount.o refcount.o logfile.o
212        $(CPP) $(CFLAGS) -o $@ $^ $(SHLIBS)
213
214test_ie: test_ie.o threadsafe_db.o logfile.o test_util.o libie.a
215        $(CPP) $(CFLAGS) -o $@ $^ $(SHLIBS)
216
217test_setuid: test_setuid.o setuid.o threadsafe_db.o logfile.o
218        $(CPP) $(CFLAGS) -o $@ $^ $(SHLIBS)
219
220test_send_pdu: test_send_pdu.o $(PROTLIB) $(LIBS)
221        $(CPP) $(CFLAGS) -o $@ $^ $(SHLIBS) $(NTLP_OBJS)
222
223
224
225libs:   $(LIBS)
226
227# always checks for new things in protlib subdirs
228protliblib:
229                $(MAKE) -C $(PROTLIB_SRC) $(PROTLIB_MAKEFLAGS)
230
231$(PROTLIB_LIB): 
232                $(MAKE) -C $(PROTLIB_SRC) $(PROTLIB_MAKEFLAGS) $(@F)
233
234$(FQUEUE_LIB): 
235                $(MAKE) -C $(FQUEUE_DIR)
236
237$(SCTP_LIB):
238        $(MAKE) -C $(SCTP_DIR)
239
240clean: 
241                $(RM) $(PDUDIR)/*.o *.o *~ \#*\# core $(INC)/*~ $(GISTLIB) $(GISTLIB_SHARED)
242
243dellogs: 
244                $(RM) *.log
245
246distclean:      clean dellogs
247                $(RM) $(TARGETS)
248                $(RM) -r cxx_repository
249                $(RM) so_locations
250
251clobber:        distclean
252
253freshdepend: depend
254
255# depend: *.cpp ../include/*.h
256depend:
257        $(CPP) -MM $(NTLP_SRCS) $(INCLUDE) > dependfile
258
259dependfile:
260ifneq ($(DEPENDFILE),dependfile)
261        $(CPP) -MM $(NTLP_SRCS) $(INCLUDE) > dependfile
262endif
263
264TAGS:
265        - etags --language-force=c++ $(INC)/*.h $(NTLP_SRCS) $(PROTLIB_INC)/*.h $(PROTLIB_SRC)/*.cpp
266
267
268ls:             
269                @ls -x --width=60 $(NTLP_SRCS) > .ls.tmp
270                @cat .ls.tmp |  sed s/\ /\ /g | sed s/\ \ /\ /g  > .ls.sed.tmp
271                @echo ""
272                @cat .ls.sed.tmp | sed s/\ \ /\ /g
273                @echo ""
274                @cat .ls.sed.tmp | sed s/\ \ /\ /g | sed s/\.cpp/\.o/g
275                @echo ""
276                @rm -f .ls.tmp .ls.sed.tmp
277
278
279#compile rules
280
281%.o:            %.cpp
282                $(RM) $@
283                $(CPP) $(CFLAGS) $(CLINK) $@ $(INCLUDE) $<
284
285#rule for Qt moc files (to process signals/slots/Q_OBJECT)
286moc_%.cpp: %.h
287           moc $< -o $@
288
289conftypecheck:
290        grep -h getconfigpar $(NTLP_SRCS) ../include/*.h | perl -pe 's/.*getconfigpar.*<\s*([^\s]+[^>]+>?)\s*>\(([^)]+)\).*/\2 \1/' | sort | uniq
291
292.PHONY: clean distclean dellogs clobber setperms TAGS depend dependfile conftypecheck
293
294### DO NOT DELETE THIS LINE -- make depend depends on it.
295-include dependfile
Note: See TracBrowser for help on using the repository browser.