summaryrefslogtreecommitdiffstats
path: root/libmediafork/Makefile
blob: 0ce595c448f6b2a5dd5ed4a745bef896ef0e5b67 (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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
SYSTEM = $(shell uname -s)

ifeq ($(SYSTEM),Linux)
	SYSDEF=-DSYS_LINUX
endif

ifeq ($(SYSTEM),CYGWIN_NT-5.1)
	SYSDEF=-DSYS_CYGWIN
endif

ifeq ($(SYSTEM),FreeBSD)
	CFLAGS += -DSYS_FREEBSD
	LDFLAGS += -pthread -lm
endif
 	
ifeq ($(SYSTEM),NetBSD)
	CFLAGS += -DSYS_NETBSD
	LDFLAGS += -lpthread -lm
endif
 	
ifeq ($(SYSTEM),Linux)
	CFLAGS += -DSYS_LINUX
	LDFLAGS += -lpthread -lm
endif

SRCS = common.c mediafork.c ports.c scan.c work.c decmpeg2.c encavcodec.c \
       update.c demuxmpeg.c fifo.c render.c reader.c muxcommon.c \
       muxmp4.c sync.c decsub.c deca52.c encfaac.c declpcm.c encx264.c \
       decavcodec.c encxvid.c muxavi.c enclame.c muxogm.c encvorbis.c \
       dvd.c  ipodutil.cpp
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 \
           ../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
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 $@"
	@ar ru $@ $(OBJS)
	@ranlib $@

libmediafork.so: $(OBJS)
	@echo "Shared library $@"
	@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 || \
	  ( echo "Compile line for $@ was:"; echo $$CMD; false )
%.o: %.cpp
	@echo "Cc $@"
	@CMD="$(CC) $(CFLAGS) -o $@ -c $<"; $$CMD || \
	( echo "Compile line for $@ was:"; echo $$CMD; false )

 	
clean:
	@echo "Clean libmediafork.a"
	@$(RM) libmediafork.*
	@echo "Clean libmediafork.so"
	@$(RM) libmediafork.so
	@echo "Clean $(OBJS)"
	@$(RM) $(OBJS)

.depend: $(SRCS)
	@echo "Checking dependencies..."
	@$(RM) .depend
	@$(foreach SRC, $(SRCS), $(CC) -MM $(SRC) $(CFLAGS) >> .depend;)
	
-include .depend