1DESTDIR ?= 2PREFIX ?= /usr/local 3LIBDIR ?= $(PREFIX)/lib 4BINDIR ?= $(PREFIX)/bin 5ifdef DEB_HOST_MULTIARCH 6LIBDIR := $(LIBDIR)/$(DEB_HOST_MULTIARCH) 7endif 8 9CC = $(CROSS_COMPILE)gcc 10AR = $(CROSS_COMPILE)ar 11LD = $(CROSS_COMPILE)gcc 12 13WARNINGS = -Wall -Wextra -Werror -Wfatal-errors 14INCLUDE_DIRS = -I ../include 15override CFLAGS := $(WARNINGS) $(INCLUDE_DIRS) -fPIC $(CFLAGS) 16 17VPATH = ../include/tinyalsa 18OBJECTS = limits.o mixer.o pcm.o pcm_plugin.o pcm_hw.o snd_card_plugin.o mixer_plugin.o mixer_hw.o 19 20LIBVERSION_MAJOR = $(TINYALSA_VERSION_MAJOR) 21LIBVERSION = $(TINYALSA_VERSION) 22 23.PHONY: all 24all: libtinyalsa.a libtinyalsa.so 25 26pcm.o: pcm.c limits.h pcm.h pcm_io.h plugin.h snd_card_plugin.h 27 28pcm_plugin.o: pcm_plugin.c asoundlib.h pcm_io.h plugin.h snd_card_plugin.h 29 30pcm_hw.o: pcm_hw.c asoundlib.h pcm_io.h 31 32limits.o: limits.c limits.h 33 34mixer.o: mixer.c mixer.h mixer_io.h plugin.h 35 36snd_card_plugin.o: snd_card_plugin.c plugin.h snd_card_plugin.h 37 38mixer_plugin.o: mixer_plugin.c mixer_io.h plugin.h snd_card_plugin.h 39 40mixer_hw.o: mixer_hw.c mixer_io.h 41 42libtinyalsa.a: $(OBJECTS) 43 $(AR) $(ARFLAGS) $@ $^ 44 45libtinyalsa.so: libtinyalsa.so.$(LIBVERSION_MAJOR) 46 ln -sf $< $@ 47 48libtinyalsa.so.$(LIBVERSION_MAJOR): libtinyalsa.so.$(LIBVERSION) 49 ln -sf $< $@ 50 51libtinyalsa.so.$(LIBVERSION): $(OBJECTS) 52 $(LD) $(LDFLAGS) -shared -Wl,-soname,libtinyalsa.so.$(LIBVERSION_MAJOR) $^ -o $@ 53 54.PHONY: clean 55clean: 56 rm -f libtinyalsa.a 57 rm -f libtinyalsa.so 58 rm -f libtinyalsa.so.$(LIBVERSION_MAJOR) 59 rm -f libtinyalsa.so.$(LIBVERSION) 60 rm -f $(OBJECTS) 61 62.PHONY: install 63install: libtinyalsa.a libtinyalsa.so.$(LIBVERSION_MAJOR) 64 install -d $(DESTDIR)$(LIBDIR)/ 65 install libtinyalsa.a $(DESTDIR)$(LIBDIR)/ 66 install libtinyalsa.so.$(LIBVERSION) $(DESTDIR)$(LIBDIR)/ 67 ln -sf libtinyalsa.so.$(LIBVERSION) $(DESTDIR)$(LIBDIR)/libtinyalsa.so.$(LIBVERSION_MAJOR) 68 ln -sf libtinyalsa.so.$(LIBVERSION_MAJOR) $(DESTDIR)$(LIBDIR)/libtinyalsa.so 69 70