From 22ab7da256ceea13963f9383e065d2ef8bfb8f5d Mon Sep 17 00:00:00 2001 From: Taylor Holberton Date: Sat, 1 Oct 2016 13:08:08 -0400 Subject: put source files into src dir --- src/Makefile | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 src/Makefile (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile new file mode 100644 index 0000000..1549650 --- /dev/null +++ b/src/Makefile @@ -0,0 +1,45 @@ +TOPDIR ?= .. +SRCDIR ?= $(TOPDIR)/src +INCDIR ?= $(TOPDIR)/include + +DESTDIR ?= +PREFIX ?= /usr/local +CROSS_COMPILE = + +CC = $(CROSS_COMPILE)gcc +CFLAGS = -Wall -Wextra -Werror -Wfatal-errors +CFLAGS += -I $(INCDIR) +CFLAGS += -fPIC + +AR = $(CROSS_COMPILE)ar +ARFLAGS = rcs + +LD = $(CROSS_COMPILE)gcc +LDFLAGS = + +OBJECTS = mixer.o pcm.o + +.PHONY: all +all: libtinyalsa.a libtinyalsa.so + +pcm.o: pcm.c $(INCDIR)/tinyalsa/pcm.h + +mixer.o: mixer.c $(INCDIR)/tinyalsa/mixer.h + +libtinyalsa.a: $(OBJECTS) + $(AR) $(ARFLAGS) $@ $^ + +libtinyalsa.so: $(OBJECTS) + $(LD) $(LDFLAGS) -shared $^ -o $@ + +.PHONY: clean +clean: + rm -f libtinyalsa.a + rm -f libtinyalsa.so + rm -f $(OBJECTS) + +.PHONY: install +install: libtinyalsa.a libtinyalsa.so + cp -u libtinyalsa.a $(DESTDIR)$(PREFIX)/lib/ + cp -u libtinyalsa.so $(DESTDIR)$(PREFIX)/lib/ + -- cgit v1.2.3