aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorTaylor Holberton <taylorcholberton@gmail.com>2016-10-01 12:55:10 -0400
committerTaylor Holberton <taylorcholberton@gmail.com>2016-10-01 12:55:10 -0400
commit626a822af99650a68e668fe8af3f06850866106f (patch)
treee33248c3298a65adf7eb9ebbd40cc1273979a4b1 /Makefile
parente67926e8ec3f5086d668c4d1e7e41feca7f8aa41 (diff)
cleaned up makefile
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile30
1 files changed, 20 insertions, 10 deletions
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