Add build system for linux
This commit is contained in:
parent
66373cc64e
commit
3a1f81dd59
5 changed files with 160 additions and 0 deletions
34
Makefile
Normal file
34
Makefile
Normal file
|
@ -0,0 +1,34 @@
|
|||
SRCS := AudioLib/main.c
|
||||
INCLUDES := -Iaudio/include
|
||||
|
||||
BUILDDIR = .build
|
||||
TARGET := libaudio-test
|
||||
OBJS := $(addprefix $(BUILDDIR)/, $(patsubst %.c,%.o, $(SRCS)))
|
||||
|
||||
CC = gcc
|
||||
AR = ar
|
||||
PKGCONFIG = pkg-config
|
||||
CFLAGS = --std=gnu99 -Wall
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
$(TARGET): $(OBJS) | audiolib
|
||||
$(CC) `$(PKGCONFIG) --libs ao` -Laudio/.build/ -Laudio/.build/libmad -Laudio/.build/speexdsp -o $(TARGET) $(OBJS) -laudio -lmad -lspeexresampler -lm
|
||||
|
||||
audiolib:
|
||||
(cd audio; make)
|
||||
|
||||
$(BUILDDIR)/%.o: %.c
|
||||
$(CC) $(INCLUDES) $(CFLAGS) -c $< -o $@
|
||||
|
||||
$(OBJS): | $(BUILDDIR)
|
||||
|
||||
$(BUILDDIR):
|
||||
mkdir -p $(BUILDDIR)/AudioLib
|
||||
|
||||
.PHONY: clean
|
||||
|
||||
clean:
|
||||
-rm $(OBJS)
|
||||
-rm $(TARGET)
|
||||
(cd audio; make clean)
|
48
audio/Makefile
Normal file
48
audio/Makefile
Normal file
|
@ -0,0 +1,48 @@
|
|||
SRCS := \
|
||||
audio.c \
|
||||
audio_internal.c \
|
||||
audio_source_file.c \
|
||||
audio_source_testtone.c \
|
||||
audio_demuxer_mp3.c \
|
||||
audio_decoder_mp3.c \
|
||||
audio_filter_param_eq.c \
|
||||
audio_filter_resample.c \
|
||||
audio_sink_file.c \
|
||||
audio_sink_libao.c
|
||||
|
||||
INCLUDES := -Iinclude
|
||||
|
||||
BUILDDIR = .build
|
||||
TARGET := $(BUILDDIR)/libaudio.a
|
||||
OBJS := $(addprefix $(BUILDDIR)/, $(patsubst %.c,%.o, $(SRCS)))
|
||||
|
||||
CC = gcc
|
||||
AR = ar
|
||||
CFLAGS = --std=gnu99 -Wall
|
||||
|
||||
all: $(TARGET) $(BUILDDIR)/libmad/libmad.a $(BUILDDIR)/speexdsp/libspeexresampler.a
|
||||
|
||||
$(TARGET): $(OBJS)
|
||||
$(AR) -cr $(TARGET) $(OBJS)
|
||||
|
||||
$(BUILDDIR)/libmad/libmad.a:
|
||||
(cd deps/mp3; make BUILDDIR=$(abspath $(BUILDDIR)/libmad))
|
||||
|
||||
$(BUILDDIR)/speexdsp/libspeexresampler.a:
|
||||
(cd deps/resampler; make BUILDDIR=$(abspath $(BUILDDIR)/speexdsp))
|
||||
|
||||
$(BUILDDIR)/%.o: %.c include/%.h
|
||||
$(CC) $(INCLUDES) $(CFLAGS) -c $< -o $@
|
||||
|
||||
$(OBJS): | $(BUILDDIR)
|
||||
|
||||
$(BUILDDIR):
|
||||
mkdir -p $(BUILDDIR)
|
||||
|
||||
.PHONY: clean
|
||||
|
||||
clean:
|
||||
-rm $(OBJS)
|
||||
-rm $(TARGET)
|
||||
(cd deps/mp3; make BUILDDIR=$(abspath $(BUILDDIR)/libmad) clean)
|
||||
(cd deps/resampler; make BUILDDIR=$(abspath $(BUILDDIR)/speexdsp) clean)
|
39
audio/deps/mp3/Makefile
Normal file
39
audio/deps/mp3/Makefile
Normal file
|
@ -0,0 +1,39 @@
|
|||
SRCS := \
|
||||
bit.c \
|
||||
fixed.c \
|
||||
frame.c \
|
||||
huffman.c \
|
||||
layer3.c \
|
||||
layer12.c \
|
||||
stream.c \
|
||||
synth.c \
|
||||
timer.c \
|
||||
version.c
|
||||
|
||||
|
||||
BUILDDIR = .build
|
||||
TARGET := $(BUILDDIR)/libmad.a
|
||||
OBJS := $(addprefix $(BUILDDIR)/, $(patsubst %.c,%.o, $(SRCS)))
|
||||
|
||||
CC = gcc
|
||||
AR = ar
|
||||
CFLAGS = --std=gnu99 -Wall
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
$(TARGET): $(OBJS)
|
||||
$(AR) -cr $(TARGET) $(OBJS)
|
||||
|
||||
$(BUILDDIR)/%.o: %.c %.h config.h
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
$(OBJS): | $(BUILDDIR)
|
||||
|
||||
$(BUILDDIR):
|
||||
mkdir -p $(BUILDDIR)
|
||||
|
||||
.PHONY: clean
|
||||
|
||||
clean:
|
||||
-rm $(OBJS)
|
||||
-rm $(TARGET)
|
28
audio/deps/resampler/Makefile
Normal file
28
audio/deps/resampler/Makefile
Normal file
|
@ -0,0 +1,28 @@
|
|||
SRCS := resample.c
|
||||
|
||||
BUILDDIR = .build
|
||||
TARGET := $(BUILDDIR)/libspeexresampler.a
|
||||
OBJS := $(addprefix $(BUILDDIR)/, $(patsubst %.c,%.o, $(SRCS)))
|
||||
|
||||
CC = gcc
|
||||
AR = ar
|
||||
CFLAGS = --std=gnu99 -Wall
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
$(TARGET): $(OBJS)
|
||||
$(AR) -cr $(TARGET) $(OBJS)
|
||||
|
||||
$(BUILDDIR)/%.o: %.c config.h
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
$(OBJS): | $(BUILDDIR)
|
||||
|
||||
$(BUILDDIR):
|
||||
mkdir -p $(BUILDDIR)
|
||||
|
||||
.PHONY: clean
|
||||
|
||||
clean:
|
||||
-rm $(OBJS)
|
||||
-rm $(TARGET)
|
11
shell.nix
Normal file
11
shell.nix
Normal file
|
@ -0,0 +1,11 @@
|
|||
{ pkgs ? import <nixpkgs> {} }:
|
||||
pkgs.mkShell {
|
||||
nativeBuildInputs = with pkgs.buildPackages; [
|
||||
libao
|
||||
pkg-config
|
||||
gcc
|
||||
file
|
||||
];
|
||||
shellHook = ''
|
||||
'';
|
||||
}
|
Loading…
Reference in a new issue