aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTaylor Holberton <taylorcholberton@gmail.com>2016-10-01 13:08:08 -0400
committerTaylor Holberton <taylorcholberton@gmail.com>2016-10-01 13:08:08 -0400
commit22ab7da256ceea13963f9383e065d2ef8bfb8f5d (patch)
tree369dc4e0430e4c602a731568511f66b5f82ae4d9
parent626a822af99650a68e668fe8af3f06850866106f (diff)
put source files into src dir
-rw-r--r--Makefile29
-rw-r--r--src/Makefile45
-rw-r--r--src/mixer.c (renamed from mixer.c)0
-rw-r--r--src/pcm.c (renamed from pcm.c)0
4 files changed, 50 insertions, 24 deletions
diff --git a/Makefile b/Makefile
index f4be161..aa6c49d 100644
--- a/Makefile
+++ b/Makefile
@@ -1,44 +1,25 @@
export TOPDIR = $(shell pwd)
-export SRCDIR = $(TOPDIR)
+export SRCDIR = $(TOPDIR)/src
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
-
.PHONY: all
-all: $(LIB) $(SHLIB)
+all:
+ $(MAKE) -C src
$(MAKE) -C utils
-$(SHLIB): $(OBJECTS)
- $(CC) $(LDFLAGS) -shared $(OBJECTS) -o $(SHLIB)
-
-$(LIB): $(OBJECTS)
- $(CROSS_COMPILE)$(AR) rcs $@ $^
-
-%.o: %.c
- $(CROSS_COMPILE)$(CC) $(CFLAGS) -fPIC -c $^ -o $@
-
.PHONY: clean
clean:
- -rm $(LIB) $(SHLIB) $(OBJECTS)
+ $(MAKE) -C src clean
$(MAKE) -C utils clean
.PHONY: install
install: $(LIB) $(SHLIB)
- cp -u $(SHLIB) $(PREFIX)/lib/
- cp -u $(LIB) $(PREFIX)/lib/
mkdir -p $(PREFIX)/include/tinyalsa
cp -Ru $(INCDIR)/tinyalsa $(PREFIX)/include/
+ $(MAKE) -C src install
$(MAKE) -C utils install
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/
+
diff --git a/mixer.c b/src/mixer.c
index ac294ca..ac294ca 100644
--- a/mixer.c
+++ b/src/mixer.c
diff --git a/pcm.c b/src/pcm.c
index 24ab333..24ab333 100644
--- a/pcm.c
+++ b/src/pcm.c