summaryrefslogtreecommitdiff
path: root/w32/mingw32/Makefile.gcc
blob: 136f7d972371dbc27570f22899d15ed1c9880ac0 (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
# Copyright (C) 2002 Open Source Telecom Corporation.
#
# This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

# A makefile to do a mingw32 cross compile build of dll's.

VPATH = ../../src:../../demo
OPATH = ../mingw32
ARCH = i586-mingw32msvc-
prefix = /usr/i586-mingw32msvc

CXX = $(ARCH)c++
AS = $(ARCH)as
DLLTOOL = $(ARCH)dlltool
DLLWRAP = $(ARCH)dllwrap
WINDRES = $(ARCH)windres
STRIP = $(ARCH)strip
exeext = .exe
dllext = .dll

CPPFLAGS = -I. -I../../src/ -D_GNU_SOURCE
CXXFLAGS = -include ${prefix}/include/cc++2/cc++/config.h -g -Wall -O2 -mthreads
LDFLAGS = -L$(prefix)/dll -lccrtp1
#-lccgnu2 -lccext2 -lws2_32
CCRTP1_LDFLAGS = -L$(prefix)/dll -lws2_32
#LDEXEC = -L$(OPATH) -lccrtp1 $(LDFLAGS)

CCRTP1_DLL_NAME = ccrtp1.dll
CCRTP1_DLL_LIB = ccrtp1.a
CCRTP1_DLL_DEF = ccrtp1.def

PROGS = rtphello.exe rtpsend.exe rtplisten.exe

all:	$(CCRTP1_DLL_NAME) $(PROGS)

SHDRS = base.h formats.h rtppkt.h rtcppkt.h sources.h socket.h \
	queuebase.h iqueue.h oqueue.h ioqueue.h cqueue.h

HDRS = $(addprefix ../../src/ccrtp, $(SHDRS))

CCRTP1_OBJS = rtppkt.o rtcppkt.o source.o data.o \
	incqueue.o outqueue.o queue.o \
	control.o members.o socket.o duplex.o pool.o

CCRTP1_DLLWRAP_FLAGS = --export-all --output-def $(CCRTP1_DLL_DEF) \
        --implib $(CCRTP1_DLL_LIB) --driver-name $(CXX)

$(CCRTP1_DLL_NAME) $(CCRTP1_DLL_DEF) $(CCRTP1_DLL_LIB): $(addprefix $(OPATH)/, $(CCRTP1_OBJS)) 
	$(DLLWRAP) $(CCRTP1_DLLWRAP_FLAGS) -o $(CCRTP1_DLL_NAME) \
	$(CCRTP1_OBJS) $(CCRTP1_LDFLAGS)

$(OPATH)/%.o: %.cpp
	$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) -o $(OPATH)/$(basename $@).o $<

%.exe: %.cpp
	$(CXX) $(CPPFLAGS) $(CXXFLAGS) $< -L. -lccrtp1 $(LDFLAGS) -o $@

clean:
	-rm -f $(CCRTP1_OBJS) 
	$(CCRTP1_DLL_NAME) $(CCRTP1_DLL_LIB) $(CCRTP1_DLL_DEF)
	$(PROGS)

install:
	-mkdir $(prefix)/include/ccrtp
	-mkdir $(prefix)/dll
	cp -af $(HDRS) $(prefix)/include/ccrtp
	cp -af $(CCRTP1_DLL_LIB) $(CCRTP1_DLL_NAME) $(prefix)/dll
	cp -af $(CCRTP1_DLL_LIB) $(prefix)/lib/libccrtp1dll.a
	$(STRIP) $(prefix)/dll/$(CCRTP1_DLL_NAME)
	ar -rs $(prefix)/lib/$(CCRTP1_DLL_LIB) $(CCRTP1_OBJS)