aboutsummaryrefslogtreecommitdiff
path: root/src/Makefile
diff options
context:
space:
mode:
authorTaylor Holberton <taylorcholberton@gmail.com>2016-10-02 09:17:19 -0400
committerTaylor Holberton <taylorcholberton@gmail.com>2016-10-02 09:17:19 -0400
commitc71dc73ee2489fe55a8f29adea9dfa56a92a950f (patch)
tree8479fc1a6b9e133b35f2b0a28b273a68e22728b2 /src/Makefile
parentfa65bc0e5fbf3339cf5b9b7f1dc73957bdc56ed0 (diff)
using LIBDIR for library install and added soversion
Diffstat (limited to 'src/Makefile')
-rw-r--r--src/Makefile42
1 files changed, 22 insertions, 20 deletions
diff --git a/src/Makefile b/src/Makefile
index 50a692f..4c392cd 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -1,45 +1,47 @@
-TOPDIR ?= ..
-INCDIR ?= $(TOPDIR)/include
-
-DEB_HOST_MULTIARCH := $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
-
DESTDIR ?=
PREFIX ?= /usr/local
-CROSS_COMPILE =
+INCDIR ?= $(PREFIX)/include
+LIBDIR ?= $(PREFIX)/lib
+BINDIR ?= $(PREFIX)/bin
+ifdef DEB_HOST_MULTIARCH
+LIBDIR := $(LIBDIR)/$(DEB_HOST_MULTIARCH)
+endif
+CROSS_COMPILE =
CC = $(CROSS_COMPILE)gcc
-override CFLAGS := -Wall -Wextra -Werror -Wfatal-errors -I $(INCDIR) -fPIC $(CFLAGS)
-
AR = $(CROSS_COMPILE)ar
-ARFLAGS = rcs
-
LD = $(CROSS_COMPILE)gcc
-LDFLAGS =
+WARNINGS = -Wall -Wextra -Werror -Wfatal-errors
+INCLUDE_DIRS = -I ../include
+override CFLAGS := $(WARNINGS) $(INCLUDE_DIRS) -fPIC $(CFLAGS)
+
+VPATH = ../include/tinyalsa
OBJECTS = mixer.o pcm.o
.PHONY: all
-all: libtinyalsa.a libtinyalsa.so
+all: libtinyalsa.a libtinyalsa.so.1
-pcm.o: pcm.c $(INCDIR)/tinyalsa/pcm.h
+pcm.o: pcm.c pcm.h
-mixer.o: mixer.c $(INCDIR)/tinyalsa/mixer.h
+mixer.o: mixer.c mixer.h
libtinyalsa.a: $(OBJECTS)
$(AR) $(ARFLAGS) $@ $^
-libtinyalsa.so: $(OBJECTS)
+libtinyalsa.so.1: $(OBJECTS)
$(LD) $(LDFLAGS) -shared $^ -o $@
.PHONY: clean
clean:
rm -f libtinyalsa.a
- rm -f libtinyalsa.so
+ rm -f libtinyalsa.so.1
rm -f $(OBJECTS)
.PHONY: install
-install: libtinyalsa.a libtinyalsa.so
- mkdir -p $(DESTDIR)$(PREFIX)/lib/$(DEB_HOST_MULTIARCH)
- cp -u libtinyalsa.a $(DESTDIR)$(PREFIX)/lib/$(DEB_HOST_MULTIARCH)
- cp -u libtinyalsa.so $(DESTDIR)$(PREFIX)/lib/$(DEB_HOST_MULTIARCH)
+install: libtinyalsa.a libtinyalsa.so.1
+ mkdir -p $(DESTDIR)$(LIBDIR)/
+ ln -sf libtinyalsa.so.1 $(DESTDIR)$(LIBDIR)/libtinyalsa.so
+ cp -u libtinyalsa.a $(DESTDIR)$(LIBDIR)/
+ cp -u libtinyalsa.so.1 $(DESTDIR)$(LIBDIR)/