From 56ceb3ea7fe9ef229a666aeb99876007a1f3f31e Mon Sep 17 00:00:00 2001 From: prigaux Date: Sat, 10 Feb 2007 16:45:23 +0000 Subject: [PATCH] Initial makefile build system for CYGWIN and .dll generation. To build on windows, type: make clean all Target are as for Linux: all clean mrproper mrproper cleans the contrib libraries and as such the build will be very very very long... Note that jam.exe must be in the $PATH as it is used to build the contrib folder. git-svn-id: svn://svn.handbrake.fr/HandBrake/branches/MediaFork_0.8.0_mpeg4ip@283 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- Makefile | 22 ++++++++++++++++++++++ libmediafork/Makefile | 26 +++++++++++++++++++++++--- test/BUILDSHARED | 11 +++++++++++ test/Makefile | 10 +++++++++- 4 files changed, 65 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 95da848c7..ed1f05384 100644 --- a/Makefile +++ b/Makefile @@ -40,3 +40,25 @@ mrproper: clean (rm -rf contrib/lib ; rm -rf contrib/include/* ) endif + +ifeq ($(SYSTEM),CYGWIN_NT-5.1) + +all: contrib/lib libmediafork/libmediafork.a MediaForkCLI + +contrib/lib: + (./configure ; cd contrib ; cp -f ../config.jam . ; jam.exe ; cd ..) + +libmediafork/libmediafork.a: + @$(MAKE) --no-print-directory -C libmediafork all + +MediaForkCLI: + @$(MAKE) --no-print-directory -C test all + +clean: + @$(MAKE) --no-print-directory -C libmediafork clean + @$(MAKE) --no-print-directory -C test clean + +mrproper: clean + (rm -rf contrib/lib ; rm -rf contrib/include/* ) + +endif diff --git a/libmediafork/Makefile b/libmediafork/Makefile index 5ad8733a9..0ce595c44 100644 --- a/libmediafork/Makefile +++ b/libmediafork/Makefile @@ -4,7 +4,7 @@ ifeq ($(SYSTEM),Linux) SYSDEF=-DSYS_LINUX endif -ifeq ($(SYSTEM),Cygwin) +ifeq ($(SYSTEM),CYGWIN_NT-5.1) SYSDEF=-DSYS_CYGWIN endif @@ -31,6 +31,17 @@ SRCS = common.c mediafork.c ports.c scan.c work.c decmpeg2.c encavcodec.c \ OTMP = $(SRCS:%.c=%.o) OBJS = $(OTMP:%.cpp=%.o) +ifeq ($(SYSTEM),CYGWIN_NT-5.1) +CONTRIBS = ../contrib/lib/liba52.a ../contrib/lib/libavformat.a \ + ../contrib/lib/libavcodec.a ../contrib/lib/libavutil.a \ + ../contrib/lib/libdvdread.a \ + ../contrib/lib/libfaac.a ../contrib/lib/libmp3lame.a \ + ../contrib/lib/libmpeg2.a ../contrib/lib/libmpeg2convert.a \ + ../contrib/lib/libvorbis.a ../contrib/lib/libvorbisenc.a \ + ../contrib/lib/libvorbisfile.a ../contrib/lib/libogg.a \ + ../contrib/lib/libsamplerate.a ../contrib/lib/libx264.a \ + ../contrib/lib/libxvidcore.a ../contrib/lib/libmp4v2.a +else CONTRIBS = ../contrib/lib/liba52.a ../contrib/lib/libavformat.a \ ../contrib/lib/libavcodec.a ../contrib/lib/libavutil.a \ ../contrib/lib/libdvdread.a ../contrib/lib/libdvdcss.a \ @@ -40,13 +51,17 @@ CONTRIBS = ../contrib/lib/liba52.a ../contrib/lib/libavformat.a \ ../contrib/lib/libvorbisfile.a ../contrib/lib/libogg.a \ ../contrib/lib/libsamplerate.a ../contrib/lib/libx264.a \ ../contrib/lib/libxvidcore.a ../contrib/lib/libmp4v2.a - +endif BUILD = $(shell date "+%Y%m%d") CFLAGS += -I../contrib/include -D__LIBMEDIAFORK__ -DUSE_PTHREAD -DHB_VERSION=\"0.8.0b1\" -DHB_BUILD=$(BUILD) $(SYSDEF) CXXFLAGS += -I../contrib/include -D__LIBMEDIAFORK__ -DUSE_PTHREAD -DHB_VERSION=\"0.8.0b1\" -DHB_BUILD=$(BUILD) $(SYSDEF) +ifeq ($(SYSTEM),CYGWIN_NT-5.1) +all: libmediafork.a libmediafork.dll +else all: libmediafork.a libmediafork.so +endif libmediafork.a: $(OBJS) @echo "Library $@" @@ -58,6 +73,11 @@ libmediafork.so: $(OBJS) @g++ -o $@ $(OBJS) $(CONTRIBS) -shared $(CFLAGS) || \ ( echo "Compile line for $@ was:"; echo $$CMD; false ) +libmediafork.dll: $(OBJS) + @echo "Shared library $@" + @g++ -o $@ $(OBJS) $(CONTRIBS) -shared $(CFLAGS) || \ + ( echo "Compile line for $@ was:"; echo $$CMD; false ) + %.o: %.c @echo "Cc $@" @CMD="$(CC) $(CFLAGS) -o $@ -c $<"; $$CMD || \ @@ -70,7 +90,7 @@ libmediafork.so: $(OBJS) clean: @echo "Clean libmediafork.a" - @$(RM) libmediafork.a + @$(RM) libmediafork.* @echo "Clean libmediafork.so" @$(RM) libmediafork.so @echo "Clean $(OBJS)" diff --git a/test/BUILDSHARED b/test/BUILDSHARED index 4cbe318e2..a2f015555 100644 --- a/test/BUILDSHARED +++ b/test/BUILDSHARED @@ -23,3 +23,14 @@ ldd test ------------------------------------------------------------------------ +To test the MediaFork .dll on cygwin issue the following commands: +================================================================== + +cp ../libmediafork/libmediafork.dll . +gcc -I../libmediafork -L. -lmediafork test.c -o test -lz -lpthread + +The resulting binary test should depend on the cygwin dll and the mediafork dll. + +I works like that but wasn't tested yet outside of cygwin. + +------------------------------------------------------------------------ diff --git a/test/Makefile b/test/Makefile index 8ccc25b49..3e7a65971 100644 --- a/test/Makefile +++ b/test/Makefile @@ -1,8 +1,15 @@ +SYSTEM = $(shell uname -s) + +ifeq ($(SYSTEM),CYGWIN_NT-5.1) + LIBS = a52 avformat avcodec avutil dvdread faac mp3lame mpeg2 vorbis vorbisenc ogg samplerate x264 xvidcore mp4v2 +else + LIBS = a52 avformat avcodec avutil dvdread dvdcss faac mp3lame mpeg2 vorbis vorbisenc ogg samplerate x264 xvidcore mp4v2 +endif + all: ../MediaForkCLI CFLAGS += -I../libmediafork CXXFLAGS += -I../libmediafork -LIBS = a52 avformat avcodec avutil dvdread dvdcss faac mp3lame mpeg2 vorbis vorbisenc ogg samplerate x264 xvidcore mp4v2 LIBS2 = ../libmediafork/libmediafork.a $(LIBS:%=../contrib/lib/lib%.a) LDFLAGS += $(LIBS2) @@ -17,5 +24,6 @@ LDFLAGS += $(LIBS2) clean: @echo "Clean MediaForkCLI" @$(RM) ../MediaForkCLI + @$(RM) ../MediaForkCLI.exe @$(RM) *.o -- 2.40.0