Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

[3a2808]: Makefile Maximize Restore History

Download this file

Makefile    167 lines (123 with data), 4.7 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
CFLAGS += $(USEDEBUG) -Wall -funsigned-char
CFLAGS += -I$(CURDIR) -I$(SRC_PATH)/src
CFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE
CFLAGS += -DHAVE_CONFIG_H -DHAVE_DLFCN_H
L=libdvdread
DVDREAD_L=libdvdread
DVDREAD_LIB = $(DVDREAD_L).a
DVDREAD_SHLIB = $(DVDREAD_L).so
VPATH+= $(SRC_PATH_BARE)/src
DVDREAD_HEADERS = src/dvdread/dvd_reader.h \
src/dvdread/ifo_print.h \
src/dvdread/ifo_read.h \
src/dvdread/ifo_types.h \
src/dvdread/nav_print.h \
src/dvdread/nav_read.h \
src/dvdread/dvd_udf.h \
src/dvdread/nav_types.h \
src/dvdread/bitreader.h
DVDREAD_SRCS = dvd_input.c dvd_reader.c dvd_udf.c ifo_print.c ifo_read.c \
md5.c nav_print.c nav_read.c bitreader.c
CFLAGS += -I$(SRC_PATH)/src
LIB = $(L).a
SHLIB = $(L).so
.OBJDIR= obj
DEPFLAG = -M
OBJS = $(patsubst %.c,%.o, $(SRCS))
DVDREAD_OBJS = $(patsubst %.c,%.o, $(DVDREAD_SRCS))
SHOBJS = $(patsubst %.c,%.so, $(SRCS))
DVDREAD_SHOBJS = $(patsubst %.c,%.so, $(DVDREAD_SRCS))
DEPS= ${OBJS:%.o=%.d}
DVDREAD_DEPS= ${DVDREAD_OBJS:%.o=%.d}
BUILDDEPS = Makefile config.mak
ifeq ($(BUILD_SHARED),yes)
all: $(SHLIB) $(DVDREAD_SHLIB) dvdread-config pkgconfig
install: $(SHLIB) $(DVDREAD_SHLIB) install-shared install-dvdread-config install-pkgconfig
endif
ifeq ($(BUILD_STATIC),yes)
all: $(LIB) $(DVDREAD_LIB) dvdread-config pkgconfig
install: $(LIB) $(DVDREAD_LIB) install-static install-dvdread-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) $(DVDREAD_SRCS): version.h
# General targets
${DVDREAD_LIB}: version.h $(DVDREAD_OBJS) $(BUILDDEPS)
cd $(.OBJDIR) && $(AR) rc $@ $(DVDREAD_OBJS)
cd $(.OBJDIR) && $(RANLIB) $@
${DVDREAD_SHLIB}: version.h $(DVDREAD_SHOBJS) $(BUILDDEPS)
cd $(.OBJDIR) && $(CC) $(SHLDFLAGS) $(LDFLAGS) -ldl -Wl,-soname=$(DVDREAD_SHLIB).$(SHLIB_MAJOR) -o $@ $(DVDREAD_SHOBJS)
.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)$(dvdread_incdir)
install -m 644 $(DVDREAD_HEADERS) $(DESTDIR)$(dvdread_incdir)
install-shared: $(SHLIB)
install -d $(DESTDIR)$(shlibdir)
install $(INSTALLSTRIP) -m 755 $(.OBJDIR)/$(SHLIB) \
$(DESTDIR)$(shlibdir)/$(SHLIB).$(SHLIB_VERSION)
cd $(DESTDIR)$(shlibdir) && \
ln -sf $(SHLIB).$(SHLIB_VERSION) $(SHLIB).$(SHLIB_MAJOR)
cd $(DESTDIR)$(shlibdir) && \
ln -sf $(SHLIB).$(SHLIB_MAJOR) $(SHLIB)
install $(INSTALLSTRIP) -m 755 $(.OBJDIR)/$(DVDREAD_SHLIB) \
$(DESTDIR)$(shlibdir)/$(DVDREAD_SHLIB).$(SHLIB_VERSION)
cd $(DESTDIR)$(shlibdir) && \
ln -sf $(DVDREAD_SHLIB).$(SHLIB_VERSION) $(DVDREAD_SHLIB).$(SHLIB_MAJOR)
cd $(DESTDIR)$(shlibdir) && \
ln -sf $(DVDREAD_SHLIB).$(SHLIB_MAJOR) $(DVDREAD_SHLIB)
install-static: $(LIB)
install -d $(DESTDIR)$(libdir)
install $(INSTALLSTRIP) -m 755 $(.OBJDIR)/$(LIB) $(DESTDIR)$(libdir)/$(LIB)
install $(INSTALLSTRIP) -m 755 $(.OBJDIR)/$(DVDREAD_LIB) $(DESTDIR)$(libdir)/$(DVDREAD_LIB)
# Clean targets
clean:
rm -rf *~ $(.OBJDIR)/* version.h
distclean: clean
find . -name "*~" | xargs rm -rf
rm -rf config.mak $(.OBJDIR)
dvdread-config: $(.OBJDIR)/dvdread-config
$(.OBJDIR)/dvdread-config: $(BUILDDEPS)
@echo '#!/bin/sh' > $(.OBJDIR)/dvdread-config
@echo 'prefix='$(PREFIX) >> $(.OBJDIR)/dvdread-config
@echo 'libdir='$(shlibdir) >> $(.OBJDIR)/dvdread-config
@echo 'version='$(SHLIB_VERSION) >> $(.OBJDIR)/dvdread-config
@echo >> $(.OBJDIR)/dvdread-config
cat $(SRC_PATH_BARE)/misc/dvdread-config.sh >> $(.OBJDIR)/dvdread-config
chmod 0755 $(.OBJDIR)/dvdread-config
install-dvdread-config: dvdread-config
install -d $(DESTDIR)$(PREFIX)/bin
install -m 0755 $(.OBJDIR)/dvdread-config $(DESTDIR)$(PREFIX)/bin/dvdread-config
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),'
pkgconfig: $(.OBJDIR)/dvdread.pc
$(.OBJDIR)/dvdread.pc: misc/dvdread.pc.in $(BUILDDEPS)
$(pcedit) $< > $@
install-pkgconfig: $(.OBJDIR)/dvdread.pc
install -d $(DESTDIR)$(libdir)/pkgconfig
install -m 0644 $(.OBJDIR)/dvdread.pc $(DESTDIR)$(libdir)/pkgconfig
vpath %.so ${.OBJDIR}
vpath %.o ${.OBJDIR}
vpath ${LIB} ${.OBJDIR}
# include dependency files if they exist
$(addprefix ${.OBJDIR}/, ${DEPS}): ;
-include $(addprefix ${.OBJDIR}/, ${DEPS})