blob: 136f7d972371dbc27570f22899d15ed1c9880ac0 [file] [log] [blame]
Emeric Vigier2f625822012-08-06 11:09:52 -04001# Copyright (C) 2002 Open Source Telecom Corporation.
2#
3# This file is free software; as a special exception the author gives
4# unlimited permission to copy and/or distribute it, with or without
5# modifications, as long as this notice is preserved.
6#
7# This program is distributed in the hope that it will be useful, but
8# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
9# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
11# A makefile to do a mingw32 cross compile build of dll's.
12
13VPATH = ../../src:../../demo
14OPATH = ../mingw32
15ARCH = i586-mingw32msvc-
16prefix = /usr/i586-mingw32msvc
17
18CXX = $(ARCH)c++
19AS = $(ARCH)as
20DLLTOOL = $(ARCH)dlltool
21DLLWRAP = $(ARCH)dllwrap
22WINDRES = $(ARCH)windres
23STRIP = $(ARCH)strip
24exeext = .exe
25dllext = .dll
26
27CPPFLAGS = -I. -I../../src/ -D_GNU_SOURCE
28CXXFLAGS = -include ${prefix}/include/cc++2/cc++/config.h -g -Wall -O2 -mthreads
29LDFLAGS = -L$(prefix)/dll -lccrtp1
30#-lccgnu2 -lccext2 -lws2_32
31CCRTP1_LDFLAGS = -L$(prefix)/dll -lws2_32
32#LDEXEC = -L$(OPATH) -lccrtp1 $(LDFLAGS)
33
34CCRTP1_DLL_NAME = ccrtp1.dll
35CCRTP1_DLL_LIB = ccrtp1.a
36CCRTP1_DLL_DEF = ccrtp1.def
37
38PROGS = rtphello.exe rtpsend.exe rtplisten.exe
39
40all: $(CCRTP1_DLL_NAME) $(PROGS)
41
42SHDRS = base.h formats.h rtppkt.h rtcppkt.h sources.h socket.h \
43 queuebase.h iqueue.h oqueue.h ioqueue.h cqueue.h
44
45HDRS = $(addprefix ../../src/ccrtp, $(SHDRS))
46
47CCRTP1_OBJS = rtppkt.o rtcppkt.o source.o data.o \
48 incqueue.o outqueue.o queue.o \
49 control.o members.o socket.o duplex.o pool.o
50
51CCRTP1_DLLWRAP_FLAGS = --export-all --output-def $(CCRTP1_DLL_DEF) \
52 --implib $(CCRTP1_DLL_LIB) --driver-name $(CXX)
53
54$(CCRTP1_DLL_NAME) $(CCRTP1_DLL_DEF) $(CCRTP1_DLL_LIB): $(addprefix $(OPATH)/, $(CCRTP1_OBJS))
55 $(DLLWRAP) $(CCRTP1_DLLWRAP_FLAGS) -o $(CCRTP1_DLL_NAME) \
56 $(CCRTP1_OBJS) $(CCRTP1_LDFLAGS)
57
58$(OPATH)/%.o: %.cpp
59 $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) -o $(OPATH)/$(basename $@).o $<
60
61%.exe: %.cpp
62 $(CXX) $(CPPFLAGS) $(CXXFLAGS) $< -L. -lccrtp1 $(LDFLAGS) -o $@
63
64clean:
65 -rm -f $(CCRTP1_OBJS)
66 $(CCRTP1_DLL_NAME) $(CCRTP1_DLL_LIB) $(CCRTP1_DLL_DEF)
67 $(PROGS)
68
69install:
70 -mkdir $(prefix)/include/ccrtp
71 -mkdir $(prefix)/dll
72 cp -af $(HDRS) $(prefix)/include/ccrtp
73 cp -af $(CCRTP1_DLL_LIB) $(CCRTP1_DLL_NAME) $(prefix)/dll
74 cp -af $(CCRTP1_DLL_LIB) $(prefix)/lib/libccrtp1dll.a
75 $(STRIP) $(prefix)/dll/$(CCRTP1_DLL_NAME)
76 ar -rs $(prefix)/lib/$(CCRTP1_DLL_LIB) $(CCRTP1_OBJS)