aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: d8953843c196151f3cef27733f01cd7b8c43a8f2 (plain)
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
CFLAGS ?= -Wall
LDFLAGS ?=
INC = include
OBJECTS = mixer.o pcm.o
LIB = libtinyalsa.a
SHLIB = libtinyalsa.so
CROSS_COMPILE =
PREFIX = /usr/local

.PHONY: all
all: $(LIB) $(SHLIB) tinyplay tinycap tinymix tinypcminfo

tinyplay: $(SHLIB) tinyplay.o
	$(CROSS_COMPILE)$(CC) $(LDFLAGS) tinyplay.o -L. -ltinyalsa -o tinyplay

tinycap: $(SHLIB) tinycap.o
	$(CROSS_COMPILE)$(CC) $(LDFLAGS) tinycap.o -L. -ltinyalsa -o tinycap

tinymix: $(SHLIB) tinymix.o
	$(CROSS_COMPILE)$(CC) $(LDFLAGS) tinymix.o -L. -ltinyalsa -o tinymix

tinypcminfo: $(SHLIB) tinypcminfo.o
	$(CROSS_COMPILE)$(CC) $(LDFLAGS) tinypcminfo.o -L. -ltinyalsa -o tinypcminfo

$(SHLIB): $(OBJECTS)
	$(CROSS_COMPILE)$(CC) $(LDFLAGS) -shared $(OBJECTS) -o $(SHLIB)

$(LIB): $(OBJECTS)
	$(CROSS_COMPILE)$(AR) rcs $@ $^

%.o: %.c
	$(CROSS_COMPILE)$(CC) $(CFLAGS) -fPIC -c $^ -I$(INC) -o $@

.PHONY: clean
clean:
	-rm $(LIB) $(SHLIB) $(OBJECTS) tinyplay.o tinyplay tinycap.o tinycap \
	tinymix.o tinymix tinypcminfo.o tinypcminfo

.PHONY: install
install: $(LIB) $(SHLIB)
	cp -u $(SHLIB) $(PREFIX)/lib/$(SHLIB)
	cp -u $(LIB) $(PREFIX)/lib/$(LIB)
	mkdir -p $(PREFIX)/include/tinyalsa
	cp -u $(INC)/tinyalsa/asoundlib.h $(PREFIX)/include/tinyalsa/asoundlib.h