diff options
author | Arun Raghavan <arun@centricular.com> | 2016-01-28 13:11:42 +0530 |
---|---|---|
committer | Arun Raghavan <git@arunraghavan.net> | 2016-01-28 15:07:46 +0530 |
commit | 48ba21b517c13025aa56ad89b12af0e1d6c743af (patch) | |
tree | 9fbb4655fb58dc13acb3c504ab6da370b846e53a /Makefile | |
parent | ad66b45add9677c4a732fc3a020f7b5d19c38def (diff) |
build: Redo Makefile a bit
A few changes:
* Don't hardcode 'gcc' and use $(CC) instead
* Split off CFLAGS/LDFLAGS so we can pick them up from the environment
* Add a static library build
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 35 |
1 files changed, 20 insertions, 15 deletions
@@ -1,29 +1,34 @@ -CFLAGS = -c -fPIC -Wall +CFLAGS ?= -Wall +LDFLAGS ?= INC = include OBJECTS = mixer.o pcm.o -LIB = libtinyalsa.so +LIB = libtinyalsa.a +SHLIB = libtinyalsa.so CROSS_COMPILE = -all: $(LIB) tinyplay tinycap tinymix tinypcminfo +all: $(LIB) $(SHLIB) tinyplay tinycap tinymix tinypcminfo -tinyplay: $(LIB) tinyplay.o - $(CROSS_COMPILE)gcc tinyplay.o -L. -ltinyalsa -o tinyplay +tinyplay: $(SHLIB) tinyplay.o + $(CROSS_COMPILE)$(CC) $(LDFLAGS) tinyplay.o -L. -ltinyalsa -o tinyplay -tinycap: $(LIB) tinycap.o - $(CROSS_COMPILE)gcc tinycap.o -L. -ltinyalsa -o tinycap +tinycap: $(SHLIB) tinycap.o + $(CROSS_COMPILE)$(CC) $(LDFLAGS) tinycap.o -L. -ltinyalsa -o tinycap -tinymix: $(LIB) tinymix.o - $(CROSS_COMPILE)gcc tinymix.o -L. -ltinyalsa -o tinymix +tinymix: $(SHLIB) tinymix.o + $(CROSS_COMPILE)$(CC) $(LDFLAGS) tinymix.o -L. -ltinyalsa -o tinymix -tinypcminfo: $(LIB) tinypcminfo.o - $(CROSS_COMPILE)gcc tinypcminfo.o -L. -ltinyalsa -o tinypcminfo +tinypcminfo: $(SHLIB) tinypcminfo.o + $(CROSS_COMPILE)$(CC) $(LDFLAGS) tinypcminfo.o -L. -ltinyalsa -o tinypcminfo + +$(SHLIB): $(OBJECTS) + $(CROSS_COMPILE)$(CC) $(LDFLAGS) -shared $(OBJECTS) -o $(SHLIB) $(LIB): $(OBJECTS) - $(CROSS_COMPILE)gcc -shared $(OBJECTS) -o $(LIB) + $(CROSS_COMPILE)$(AR) rcs $@ $^ -.c.o: - $(CROSS_COMPILE)gcc $(CFLAGS) $< -I$(INC) +%.o: %.c + $(CROSS_COMPILE)$(CC) $(CFLAGS) -fPIC -c $^ -I$(INC) -o $@ clean: - -rm $(LIB) $(OBJECTS) tinyplay.o tinyplay tinycap.o tinycap \ + -rm $(LIB) $(SHLIB) $(OBJECTS) tinyplay.o tinyplay tinycap.o tinycap \ tinymix.o tinymix tinypcminfo.o tinypcminfo |