From 626a822af99650a68e668fe8af3f06850866106f Mon Sep 17 00:00:00 2001 From: Taylor Holberton Date: Sat, 1 Oct 2016 12:55:10 -0400 Subject: cleaned up makefile --- Makefile | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 55bd9e6..f4be161 100644 --- a/Makefile +++ b/Makefile @@ -1,24 +1,33 @@ -CFLAGS ?= -Wall -LDFLAGS ?= -INC = include +export TOPDIR = $(shell pwd) +export SRCDIR = $(TOPDIR) +export INCDIR = $(TOPDIR)/include + +export DESTDIR ?= +export PREFIX ?= /usr/local +export CROSS_COMPILE = + +CC = $(CROSS_COMPILE)gcc +CFLAGS = -Wall -Wextra -Werror -Wfatal-errors -I $(INCDIR) + +LD = $(CROSS_COMPILE)ld +LDFLAGS = + 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) + $(CC) $(LDFLAGS) -shared $(OBJECTS) -o $(SHLIB) $(LIB): $(OBJECTS) $(CROSS_COMPILE)$(AR) rcs $@ $^ %.o: %.c - $(CROSS_COMPILE)$(CC) $(CFLAGS) -fPIC -c $^ -I$(INC) -o $@ + $(CROSS_COMPILE)$(CC) $(CFLAGS) -fPIC -c $^ -o $@ .PHONY: clean clean: @@ -27,8 +36,9 @@ clean: .PHONY: install install: $(LIB) $(SHLIB) - cp -u $(SHLIB) $(PREFIX)/lib/$(SHLIB) - cp -u $(LIB) $(PREFIX)/lib/$(LIB) + cp -u $(SHLIB) $(PREFIX)/lib/ + cp -u $(LIB) $(PREFIX)/lib/ mkdir -p $(PREFIX)/include/tinyalsa - cp -u $(INC)/tinyalsa/asoundlib.h $(PREFIX)/include/tinyalsa/asoundlib.h + cp -Ru $(INCDIR)/tinyalsa $(PREFIX)/include/ + $(MAKE) -C utils install -- cgit v1.2.3