aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 55bd9e62fb506b0cbe80d0488592815b72da97a3 (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
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)
	$(MAKE) -C utils

$(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)
	$(MAKE) -C utils clean

.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