Emeric Vigier | 2f62582 | 2012-08-06 11:09:52 -0400 | [diff] [blame] | 1 | # 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 | |
| 13 | VPATH = ../../src:../../demo |
| 14 | OPATH = ../mingw32 |
| 15 | ARCH = i586-mingw32msvc- |
| 16 | prefix = /usr/i586-mingw32msvc |
| 17 | |
| 18 | CXX = $(ARCH)c++ |
| 19 | AS = $(ARCH)as |
| 20 | DLLTOOL = $(ARCH)dlltool |
| 21 | DLLWRAP = $(ARCH)dllwrap |
| 22 | WINDRES = $(ARCH)windres |
| 23 | STRIP = $(ARCH)strip |
| 24 | exeext = .exe |
| 25 | dllext = .dll |
| 26 | |
| 27 | CPPFLAGS = -I. -I../../src/ -D_GNU_SOURCE |
| 28 | CXXFLAGS = -include ${prefix}/include/cc++2/cc++/config.h -g -Wall -O2 -mthreads |
| 29 | LDFLAGS = -L$(prefix)/dll -lccrtp1 |
| 30 | #-lccgnu2 -lccext2 -lws2_32 |
| 31 | CCRTP1_LDFLAGS = -L$(prefix)/dll -lws2_32 |
| 32 | #LDEXEC = -L$(OPATH) -lccrtp1 $(LDFLAGS) |
| 33 | |
| 34 | CCRTP1_DLL_NAME = ccrtp1.dll |
| 35 | CCRTP1_DLL_LIB = ccrtp1.a |
| 36 | CCRTP1_DLL_DEF = ccrtp1.def |
| 37 | |
| 38 | PROGS = rtphello.exe rtpsend.exe rtplisten.exe |
| 39 | |
| 40 | all: $(CCRTP1_DLL_NAME) $(PROGS) |
| 41 | |
| 42 | SHDRS = base.h formats.h rtppkt.h rtcppkt.h sources.h socket.h \ |
| 43 | queuebase.h iqueue.h oqueue.h ioqueue.h cqueue.h |
| 44 | |
| 45 | HDRS = $(addprefix ../../src/ccrtp, $(SHDRS)) |
| 46 | |
| 47 | CCRTP1_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 | |
| 51 | CCRTP1_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 | |
| 64 | clean: |
| 65 | -rm -f $(CCRTP1_OBJS) |
| 66 | $(CCRTP1_DLL_NAME) $(CCRTP1_DLL_LIB) $(CCRTP1_DLL_DEF) |
| 67 | $(PROGS) |
| 68 | |
| 69 | install: |
| 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) |