aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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