[6c47b8]: Makefile  Maximize  Restore  History

Download this file

167 lines (122 with data), 4.8 kB

  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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
include config.mak
.SUFFIXES: .so
AR=ar
LD=ld
RANLIB=ranlib
VPATH+= $(SRC_PATH_BARE)/src
SRCS = dvdnav.c highlight.c navigation.c read_cache.c remap.c searching.c settings.c
VPATH+= $(SRC_PATH_BARE)/src/vm
SRCS+= decoder.c vm.c vmcmd.c
HEADERS = src/dvd_types.h src/dvdnav.h src/dvdnav_events.h
CFLAGS += $(USEDEBUG) -Wall -funsigned-char
CFLAGS += -I$(CURDIR) -I$(SRC_PATH)/src -I$(SRC_PATH)/src/vm
CFLAGS += -DDVDNAV_COMPILE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE
CFLAGS += -DHAVE_CONFIG_H -DHAVE_DLFCN_H
L=libdvdnav
MINI_L=libdvdnavmini
CFLAGS += $(DVDREAD_CFLAGS)
LIB = $(L).a
SHLIB = $(L).so
MINI_SHLIB = $(MINI_L).so
.OBJDIR= obj
DEPFLAG = -M
OBJS = $(patsubst %.c,%.o, $(SRCS))
SHOBJS = $(patsubst %.c,%.so, $(SRCS))
DEPS= ${OBJS:%.o=%.d}
BUILDDEPS = Makefile config.mak
ifeq ($(BUILD_SHARED),yes)
all: $(SHLIB) $(MINI_SHLIB) dvdnav-config pkgconfig
install: $(SHLIB) install-shared install-dvdnav-config install-pkgconfig
endif
ifeq ($(BUILD_STATIC),yes)
all: $(LIB) dvdnav-config pkgconfig
install: $(LIB) install-static install-dvdnav-config install-pkgconfig
endif
install: install-headers
# Let version.sh create version.h
SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries
ifeq ($(wildcard $(SVN_ENTRIES)),$(SVN_ENTRIES))
version.h: $(SVN_ENTRIES)
endif
version.h:
sh $(SRC_PATH)/version.sh $(SRC_PATH) "$(SHLIB_VERSION)"
$(SRCS): version.h
# General targets
${LIB}: version.h $(OBJS) $(BUILDDEPS)
cd $(.OBJDIR) && $(AR) rc $@ $(OBJS)
cd $(.OBJDIR) && $(RANLIB) $@
${SHLIB}: version.h $(SHOBJS) $(BUILDDEPS)
cd $(.OBJDIR) && $(CC) $(SHLDFLAGS) -Wl,-soname=$(SHLIB).$(SHLIB_MAJOR) -o $@ $(SHOBJS) $(DVDREAD_LIBS) $(THREADLIB)
${MINI_SHLIB}: version.h $(.OBJDIR) $(SHOBJS) $(BUILDDEPS)
cd $(.OBJDIR) && $(CC) $(SHLDFLAGS) -Wl,-soname=$(MINI_SHLIB).$(SHLIB_MAJOR) -o $@ $(SHOBJS) $(THREADLIB)
.c.so: $(BUILDDEPS)
cd $(.OBJDIR) && $(CC) -fPIC -DPIC -MD $(CFLAGS) -c -o $@ $<
.c.o: $(BUILDDEPS)
cd $(.OBJDIR) && $(CC) -MD $(CFLAGS) -c -o $@ $<
# Install targets
install-headers:
install -d $(DESTDIR)$(incdir)
install -m 644 $(HEADERS) $(DESTDIR)$(incdir)
install-shared: $(SHLIB)
install -d $(DESTDIR)$(shlibdir)
install $(INSTALLSTRIP) -m 755 $(.OBJDIR)/$(SHLIB) \
$(DESTDIR)$(shlibdir)/$(SHLIB).$(SHLIB_VERSION)
install $(INSTALLSTRIP) -m 755 $(.OBJDIR)/$(MINI_SHLIB) \
$(DESTDIR)$(shlibdir)/$(MINI_SHLIB).$(SHLIB_VERSION)
cd $(DESTDIR)$(shlibdir) && \
ln -sf $(SHLIB).$(SHLIB_VERSION) $(SHLIB).$(SHLIB_MAJOR)
cd $(DESTDIR)$(shlibdir) && \
ln -sf $(MINI_SHLIB).$(SHLIB_VERSION) $(MINI_SHLIB).$(SHLIB_MAJOR)
cd $(DESTDIR)$(shlibdir) && \
ln -sf $(SHLIB).$(SHLIB_MAJOR) $(SHLIB)
cd $(DESTDIR)$(shlibdir) && \
ln -sf $(MINI_SHLIB).$(SHLIB_MAJOR) $(MINI_SHLIB)
install-static: $(LIB)
install -d $(DESTDIR)$(libdir)
install $(INSTALLSTRIP) -m 755 $(.OBJDIR)/$(LIB) $(DESTDIR)$(libdir)/$(LIB)
# Clean targets
clean:
rm -rf *~ $(.OBJDIR)/* version.h
pcedit = sed \
-e 's,@prefix@,$(PREFIX),' \
-e 's,@exec_prefix@,$(PREFIX),' \
-e 's,@libdir@,$(shlibdir),' \
-e 's,@includedir@,$(PREFIX)/include,' \
-e 's,@VERSION@,$(SHLIB_VERSION),' \
-e 's,@THREAD_CFLAGS@,,' \
-e 's,@THREAD_LIBS@,$(THREADLIB),' \
-e 's,@DVDREAD_CFLAGS@,$(DVDREAD_CFLAGS),'
pkgconfig: $(.OBJDIR)/dvdnav.pc $(.OBJDIR)/dvdnavmini.pc
$(.OBJDIR)/dvdnav.pc: misc/dvdnav.pc.in $(BUILDDEPS)
$(pcedit) $< > $@
$(.OBJDIR)/dvdnavmini.pc: misc/dvdnavmini.pc.in $(BUILDDEPS)
$(pcedit) $< > $@
install-pkgconfig: $(.OBJDIR)/dvdnav.pc $(.OBJDIR)/dvdnavmini.pc
install -d $(DESTDIR)$(libdir)/pkgconfig
install -m 0644 $(.OBJDIR)/dvdnav.pc $(DESTDIR)$(libdir)/pkgconfig
install -m 0644 $(.OBJDIR)/dvdnavmini.pc \
$(DESTDIR)$(libdir)/pkgconfig
distclean: clean
find . -name "*~" | xargs rm -rf
rm -rf config.mak $(.OBJDIR)
dvdnav-config: $(.OBJDIR)/dvdnav-config
$(.OBJDIR)/dvdnav-config: $(BUILDDEPS)
@echo '#!/bin/sh' > $(.OBJDIR)/dvdnav-config
@echo 'prefix='$(PREFIX) >> $(.OBJDIR)/dvdnav-config
@echo 'libdir='$(shlibdir) >> $(.OBJDIR)/dvdnav-config
@echo 'version='$(SHLIB_VERSION) >> $(.OBJDIR)/dvdnav-config
@echo 'dvdread_cflags="'$(DVDREAD_CFLAGS)'"' >> $(.OBJDIR)/dvdnav-config
@echo 'dvdread_libs="'$(DVDREAD_LIBS)'"' >> $(.OBJDIR)/dvdnav-config
@echo 'threadlib='$(THREADLIB) >> $(.OBJDIR)/dvdnav-config
@echo >> $(.OBJDIR)/dvdnav-config
cat $(SRC_PATH_BARE)/misc/dvdnav-config2.sh >> $(.OBJDIR)/dvdnav-config
chmod 0755 $(.OBJDIR)/dvdnav-config
install-dvdnav-config: dvdnav-config
install -d $(DESTDIR)$(PREFIX)/bin
install -m 0755 $(.OBJDIR)/dvdnav-config $(DESTDIR)$(PREFIX)/bin/dvdnav-config
vpath %.so ${.OBJDIR}
vpath %.o ${.OBJDIR}
vpath ${LIB} ${.OBJDIR}
# include dependency files if they exist
$(addprefix ${.OBJDIR}/, ${DEPS}): ;
-include $(addprefix ${.OBJDIR}/, ${DEPS})