mediaextract/Makefile

206 lines
5.1 KiB
Makefile
Raw Normal View History

2012-12-28 01:13:50 +00:00
PREFIX=/usr/local
2013-01-06 05:21:09 +00:00
TARGET=$(shell uname|tr '[A-Z]' '[a-z]')$(shell getconf LONG_BIT)
2013-01-03 18:20:36 +00:00
INCLUDE=
LIBDIRS=
LIBS=
2017-11-04 00:52:50 +00:00
MANPAGE=mediaextract.1.gz
2013-01-03 06:05:11 +00:00
PLATFORM=posix
2013-01-03 18:20:36 +00:00
BUILDDIR=build-$(TARGET)
2012-12-29 00:07:41 +00:00
OBJ=\
2013-01-11 02:35:25 +00:00
$(BUILDDIR)/mediaextract.o \
$(BUILDDIR)/mediaextract_$(PLATFORM).o \
$(BUILDDIR)/riff.o \
$(BUILDDIR)/aiff.o \
2012-12-29 00:07:41 +00:00
$(BUILDDIR)/ogg.o \
2012-12-29 16:48:36 +00:00
$(BUILDDIR)/mpg123.o \
2012-12-29 21:46:34 +00:00
$(BUILDDIR)/mp4.o \
2012-12-29 00:07:41 +00:00
$(BUILDDIR)/id3.o \
$(BUILDDIR)/midi.o \
2015-08-07 19:45:37 +00:00
$(BUILDDIR)/xmidi.o \
2012-12-29 04:20:01 +00:00
$(BUILDDIR)/mod.o \
2012-12-29 05:31:30 +00:00
$(BUILDDIR)/s3m.o \
2013-01-02 03:31:45 +00:00
$(BUILDDIR)/xm.o \
2012-12-31 20:02:57 +00:00
$(BUILDDIR)/it.o \
2013-01-01 05:41:01 +00:00
$(BUILDDIR)/asf.o \
2013-01-08 02:37:10 +00:00
$(BUILDDIR)/bink.o \
2013-01-09 02:16:54 +00:00
$(BUILDDIR)/au.o \
2013-01-11 00:49:12 +00:00
$(BUILDDIR)/smk.o \
2013-01-11 02:25:29 +00:00
$(BUILDDIR)/bmp.o \
2013-01-12 04:25:12 +00:00
$(BUILDDIR)/png.o \
$(BUILDDIR)/jpg.o \
$(BUILDDIR)/gif.o \
2013-08-25 17:25:29 +00:00
$(BUILDDIR)/mpeg.o \
$(BUILDDIR)/text.o
2012-12-27 16:02:19 +00:00
CC=gcc
LD=$(CC)
CFLAGS+= -Wall -Werror -Wextra -std=gnu99 -O2 -g $(INCLUDE) $(LIBDIRS) -D_FILE_OFFSET_BITS=64
WINDOWS_LIBS=-lws2_32
2013-01-11 02:35:25 +00:00
APPNAME=mediaextract
2013-01-03 06:05:11 +00:00
BIN=$(BUILDDIR)/$(APPNAME)
ifeq ($(TARGET),win32)
PLATFORM=windows
CC=i686-w64-mingw32-gcc
CFLAGS+=-DWINVER=0x500 -m32
LDFLAGS+=-m32
2013-01-06 05:21:09 +00:00
LIBS=$(WINDOWS_LIBS)
2013-01-11 02:35:25 +00:00
APPNAME=mediaextract.exe
2013-01-03 06:05:11 +00:00
else
ifeq ($(TARGET),win64)
PLATFORM=windows
2013-01-03 18:20:36 +00:00
CC=x86_64-w64-mingw32-gcc
CFLAGS+=-DWINVER=0x500 -m64
LDFLAGS+=-m64
2013-01-06 05:21:09 +00:00
LIBS=$(WINDOWS_LIBS)
2013-01-11 02:35:25 +00:00
APPNAME=mediaextract.exe
2013-01-06 05:21:09 +00:00
else
ifeq ($(TARGET),linux32)
CFLAGS+=-pedantic -m32
LDFLAGS+=-m32
2013-01-06 05:21:09 +00:00
else
ifeq ($(TARGET),linux64)
CFLAGS+=-pedantic -m64
LDFLAGS+=-m64
2013-01-06 05:21:09 +00:00
endif
endif
2013-01-03 06:05:11 +00:00
endif
endif
2012-12-27 16:02:19 +00:00
2013-01-06 05:21:09 +00:00
.PHONY: all clean install uninstall builddir
2012-12-27 01:05:02 +00:00
2018-01-13 05:25:33 +00:00
ifeq ($(PLATFORM),posix)
2017-11-04 00:52:50 +00:00
all: $(BIN) $(BUILDDIR)/$(MANPAGE)
2018-01-13 05:25:33 +00:00
else
all: $(BIN)
endif
2012-12-27 16:02:19 +00:00
2013-01-06 05:21:09 +00:00
builddir: $(BUILDDIR)
$(BUILDDIR):
mkdir -p $(BUILDDIR)
2012-12-27 16:02:19 +00:00
$(BIN): $(OBJ)
2013-01-03 18:20:36 +00:00
$(LD) $(LIBDIRS) $(LDFLAGS) $(OBJ) -o $@ $(LIBS)
2012-12-27 16:02:19 +00:00
2013-01-11 02:35:25 +00:00
$(BUILDDIR)/mediaextract.o: src/mediaextract.c \
src/mediaextract.h \
2013-01-01 21:16:13 +00:00
src/ogg.h \
src/riff.h \
src/aiff.h \
src/mpg123.h \
src/mp4.h \
src/id3.h \
src/midi.h \
2015-08-07 19:45:37 +00:00
src/xmidi.h \
2013-01-01 21:16:13 +00:00
src/mod.h \
src/s3m.h \
2013-01-02 03:31:45 +00:00
src/xm.h \
2013-01-01 21:16:13 +00:00
src/it.h \
src/asf.h \
2013-01-08 02:37:10 +00:00
src/bink.h \
2013-01-09 02:16:54 +00:00
src/au.h \
2013-01-11 00:49:12 +00:00
src/smk.h \
2013-01-11 02:25:29 +00:00
src/bmp.h \
2013-01-12 04:25:12 +00:00
src/png.h \
src/jpg.h \
src/gif.h \
2013-08-25 17:25:29 +00:00
src/mpeg.h \
src/text.h
2013-01-03 06:05:11 +00:00
$(CC) $(CFLAGS) $< -o $@ -c $(LIBS)
2012-12-27 16:02:19 +00:00
2013-01-11 02:35:25 +00:00
$(BUILDDIR)/mediaextract_$(PLATFORM).o: src/mediaextract_$(PLATFORM).c src/mediaextract.h
2013-01-03 06:05:11 +00:00
$(CC) $(CFLAGS) $< -o $@ -c $(LIBS)
2013-01-11 02:35:25 +00:00
$(BUILDDIR)/riff.o: src/riff.c src/mediaextract.h src/riff.h
2013-01-03 06:05:11 +00:00
$(CC) $(CFLAGS) $< -o $@ -c $(LIBS)
2013-01-11 02:35:25 +00:00
$(BUILDDIR)/aiff.o: src/aiff.c src/mediaextract.h src/aiff.h
2013-01-03 06:05:11 +00:00
$(CC) $(CFLAGS) $< -o $@ -c $(LIBS)
2012-12-27 16:02:19 +00:00
2013-01-11 02:35:25 +00:00
$(BUILDDIR)/ogg.o: src/ogg.c src/mediaextract.h src/ogg.h
2013-01-03 06:05:11 +00:00
$(CC) $(CFLAGS) $< -o $@ -c $(LIBS)
2012-12-27 01:05:02 +00:00
2013-01-11 02:35:25 +00:00
$(BUILDDIR)/mpg123.o: src/mpg123.c src/mediaextract.h src/mpg123.h
2013-01-03 06:05:11 +00:00
$(CC) $(CFLAGS) $< -o $@ -c $(LIBS)
2012-12-27 01:05:02 +00:00
2013-01-11 02:35:25 +00:00
$(BUILDDIR)/mp4.o: src/mp4.c src/mediaextract.h src/mp4.h
2013-01-03 06:05:11 +00:00
$(CC) $(CFLAGS) $< -o $@ -c $(LIBS)
2012-12-29 21:46:34 +00:00
2013-01-11 02:35:25 +00:00
$(BUILDDIR)/id3.o: src/id3.c src/mediaextract.h src/id3.h
2013-01-03 06:05:11 +00:00
$(CC) $(CFLAGS) $< -o $@ -c $(LIBS)
2012-12-27 19:09:06 +00:00
2013-01-11 02:35:25 +00:00
$(BUILDDIR)/midi.o: src/midi.c src/mediaextract.h src/midi.h
2013-01-03 06:05:11 +00:00
$(CC) $(CFLAGS) $< -o $@ -c $(LIBS)
2012-12-28 17:23:27 +00:00
2015-08-07 19:45:37 +00:00
$(BUILDDIR)/xmidi.o: src/xmidi.c src/mediaextract.h src/xmidi.h
$(CC) $(CFLAGS) $< -o $@ -c $(LIBS)
2013-01-11 02:35:25 +00:00
$(BUILDDIR)/mod.o: src/mod.c src/mediaextract.h src/mod.h
2013-01-03 06:05:11 +00:00
$(CC) $(CFLAGS) $< -o $@ -c $(LIBS)
2012-12-29 00:07:41 +00:00
2013-01-11 02:35:25 +00:00
$(BUILDDIR)/s3m.o: src/s3m.c src/mediaextract.h src/s3m.h
2013-01-03 06:05:11 +00:00
$(CC) $(CFLAGS) $< -o $@ -c $(LIBS)
2012-12-29 04:20:01 +00:00
2013-01-11 02:35:25 +00:00
$(BUILDDIR)/xm.o: src/xm.c src/mediaextract.h src/xm.h
2013-01-03 06:05:11 +00:00
$(CC) $(CFLAGS) $< -o $@ -c $(LIBS)
2013-01-02 03:31:45 +00:00
2013-01-11 02:35:25 +00:00
$(BUILDDIR)/it.o: src/it.c src/mediaextract.h src/it.h
2013-01-03 06:05:11 +00:00
$(CC) $(CFLAGS) $< -o $@ -c $(LIBS)
2012-12-29 05:31:30 +00:00
2013-01-11 02:35:25 +00:00
$(BUILDDIR)/asf.o: src/asf.c src/mediaextract.h src/asf.h
2013-01-03 06:05:11 +00:00
$(CC) $(CFLAGS) $< -o $@ -c $(LIBS)
2012-12-31 20:02:57 +00:00
2013-01-11 02:35:25 +00:00
$(BUILDDIR)/bink.o: src/bink.c src/mediaextract.h src/bink.h
2013-01-03 06:05:11 +00:00
$(CC) $(CFLAGS) $< -o $@ -c $(LIBS)
2013-01-01 05:41:01 +00:00
2013-01-11 02:35:25 +00:00
$(BUILDDIR)/au.o: src/au.c src/mediaextract.h src/au.h
2013-01-08 02:37:10 +00:00
$(CC) $(CFLAGS) $< -o $@ -c $(LIBS)
2013-01-11 02:35:25 +00:00
$(BUILDDIR)/smk.o: src/smk.c src/mediaextract.h src/smk.h
2013-01-09 02:16:54 +00:00
$(CC) $(CFLAGS) $< -o $@ -c $(LIBS)
2013-01-11 02:35:25 +00:00
$(BUILDDIR)/bmp.o: src/bmp.c src/mediaextract.h src/bmp.h
2013-01-11 00:49:12 +00:00
$(CC) $(CFLAGS) $< -o $@ -c $(LIBS)
2013-01-11 02:35:25 +00:00
$(BUILDDIR)/png.o: src/png.c src/mediaextract.h src/png.h
2013-01-11 02:25:29 +00:00
$(CC) $(CFLAGS) $< -o $@ -c $(LIBS)
2013-01-12 04:25:12 +00:00
$(BUILDDIR)/jpg.o: src/jpg.c src/mediaextract.h src/jpg.h
$(CC) $(CFLAGS) $< -o $@ -c $(LIBS)
$(BUILDDIR)/gif.o: src/gif.c src/mediaextract.h src/gif.h
$(CC) $(CFLAGS) $< -o $@ -c $(LIBS)
$(BUILDDIR)/mpeg.o: src/mpeg.c src/mediaextract.h src/mpeg.h
$(CC) $(CFLAGS) $< -o $@ -c $(LIBS)
2013-08-25 17:25:29 +00:00
$(BUILDDIR)/text.o: src/text.c src/mediaextract.h src/text.h
$(CC) $(CFLAGS) $< -o $@ -c $(LIBS)
ifeq ($(PLATFORM),posix)
2017-11-04 00:52:50 +00:00
install: $(PREFIX)/bin/$(APPNAME) $(PREFIX)/share/man/man1/$(MANPAGE)
$(BUILDDIR)/$(MANPAGE):src/ManPageIncludeFile
help2man $(BIN) --no-discard-stderr --no-info -n "extracts media files that are embedded within other files" -S "Mathias Panzenböck" -i src/ManPageIncludeFile|sed '/the default set of formats/s/^/.TP\n/'|sed '/the default set of formats/{N;s/.TP//}'|sed -r '/([)]|files)$ /a .TP' >$(BUILDDIR)/$(APPNAME).1
gzip -kf $(BUILDDIR)/$(APPNAME).1
$(PREFIX)/share/man/man1/$(MANPAGE):$(BUILDDIR)/$(APPNAME).1
mkdir -p "$(PREFIX)/share/man/man1/"
install $(BUILDDIR)/$(MANPAGE) "$@"
2012-12-29 05:45:04 +00:00
2013-01-03 06:05:11 +00:00
$(PREFIX)/bin/$(APPNAME): $(BIN)
2013-01-08 02:37:10 +00:00
mkdir -p "$(PREFIX)/bin"
install -s $(BIN) "$@"
2012-12-28 01:13:50 +00:00
uninstall:
2013-01-03 06:05:11 +00:00
rm -f "$(PREFIX)/bin/$(APPNAME)"
endif
2012-12-28 01:13:50 +00:00
2015-04-20 19:04:57 +00:00
recode: $(BUILDDIR)/recode
$(BUILDDIR)/recode: src/text.c src/text.h
$(CC) $(CFLAGS) $< -o $@ -DMEDIAEXTRACT_RECODE_BIN
2012-12-27 01:05:02 +00:00
clean:
2017-11-04 00:52:50 +00:00
rm -f $(BUILDDIR)/*