mediaextract/Makefile

146 lines
3.3 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=
LDFLAGS=
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=\
$(BUILDDIR)/audioextract.o \
2013-01-03 06:05:11 +00:00
$(BUILDDIR)/audioextract_$(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 \
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 \
$(BUILDDIR)/bink.o
2012-12-27 16:02:19 +00:00
CC=gcc
LD=$(CC)
2013-01-04 04:01:24 +00:00
COMMON_CFLAGS=-Wall -Werror -Wextra -std=gnu99 -O2 -g $(INCLUDE) $(LIBDIRS) -D_FILE_OFFSET_BITS=64
2013-01-06 05:21:09 +00:00
POSIX_CFLAGS=$(COMMON_CFLAGS) -pedantic
CFLAGS=$(POSIX_CFLAGS)
WINDOWS_CFLAGS=$(COMMON_CFLAGS) -DWINVER=0x500
WINDOWS_LIBS=-lws2_32 -liberty
2013-01-03 06:05:11 +00:00
APPNAME=audioextract
BIN=$(BUILDDIR)/$(APPNAME)
ifeq ($(TARGET),win32)
PLATFORM=windows
CC=i686-pc-mingw32-gcc
2013-01-06 05:21:09 +00:00
CFLAGS=$(WINDOWS_CFLAGS) -m32
LDFLAGS=-m32
LIBS=$(WINDOWS_LIBS)
2013-01-03 06:05:11 +00:00
APPNAME=audioextract.exe
else
ifeq ($(TARGET),win64)
PLATFORM=windows
2013-01-03 18:20:36 +00:00
CC=x86_64-w64-mingw32-gcc
2013-01-06 05:21:09 +00:00
CFLAGS=$(WINDOWS_CFLAGS) -m64
LDFLAGS=-m64
LIBS=$(WINDOWS_LIBS)
2013-01-06 05:25:55 +00:00
APPNAME=audioextract.exe
2013-01-06 05:21:09 +00:00
else
ifeq ($(TARGET),linux32)
CFLAGS=$(POSIX_CFLAGS) -m32
LDFLAGS=-m32
else
ifeq ($(TARGET),linux64)
CFLAGS=$(POSIX_CFLAGS) -m64
LDFLAGS=-m64
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
2012-12-27 16:02:19 +00:00
all: $(BIN)
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-01 21:16:13 +00:00
$(BUILDDIR)/audioextract.o: src/audioextract.c \
src/audioextract.h \
src/ogg.h \
src/riff.h \
src/aiff.h \
src/mpg123.h \
src/mp4.h \
src/id3.h \
src/midi.h \
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 \
src/bink.h
2013-01-03 06:05:11 +00:00
$(CC) $(CFLAGS) $< -o $@ -c $(LIBS)
2012-12-27 16:02:19 +00:00
2013-01-03 06:05:11 +00:00
$(BUILDDIR)/audioextract_$(PLATFORM).o: src/audioextract_$(PLATFORM).c src/audioextract.h
$(CC) $(CFLAGS) $< -o $@ -c $(LIBS)
2013-01-01 21:16:13 +00:00
$(BUILDDIR)/riff.o: src/riff.c src/audioextract.h src/riff.h
2013-01-03 06:05:11 +00:00
$(CC) $(CFLAGS) $< -o $@ -c $(LIBS)
2013-01-01 21:16:13 +00:00
$(BUILDDIR)/aiff.o: src/aiff.c src/audioextract.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-01 21:16:13 +00:00
$(BUILDDIR)/ogg.o: src/ogg.c src/audioextract.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-01 21:16:13 +00:00
$(BUILDDIR)/mpg123.o: src/mpg123.c src/audioextract.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-01 21:16:13 +00:00
$(BUILDDIR)/mp4.o: src/mp4.c src/audioextract.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-01 21:16:13 +00:00
$(BUILDDIR)/id3.o: src/id3.c src/audioextract.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-01 21:16:13 +00:00
$(BUILDDIR)/midi.o: src/midi.c src/audioextract.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
2013-01-01 21:16:13 +00:00
$(BUILDDIR)/mod.o: src/mod.c src/audioextract.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-01 21:16:13 +00:00
$(BUILDDIR)/s3m.o: src/s3m.c src/audioextract.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-02 03:31:45 +00:00
$(BUILDDIR)/xm.o: src/xm.c src/audioextract.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-01 21:16:13 +00:00
$(BUILDDIR)/it.o: src/it.c src/audioextract.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-01 21:16:13 +00:00
$(BUILDDIR)/asf.o: src/asf.c src/audioextract.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-01 21:16:13 +00:00
$(BUILDDIR)/bink.o: src/bink.c src/audioextract.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
ifeq ($(PLATFORM),posix)
2013-01-03 06:05:11 +00:00
install: $(PREFIX)/bin/$(APPNAME)
2012-12-29 05:45:04 +00:00
2013-01-03 06:05:11 +00:00
$(PREFIX)/bin/$(APPNAME): $(BIN)
2012-12-29 05:45:04 +00:00
install -s -D $(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
2012-12-27 01:05:02 +00:00
clean:
2012-12-28 01:13:50 +00:00
rm -f $(BIN) $(OBJ)