summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2017-03-24 09:22:21 +1300
committerTom Ryder <tom@sanctum.geek.nz>2017-03-24 09:22:21 +1300
commita9e737766d6be3a6ccc43e166605eabc11e0d50d (patch)
treec295a739e5ab3a795b8dde76f346936afc1f3ff5
parentUpdate references to ayylmao(6) (diff)
downloadlibayylmao-a9e737766d6be3a6ccc43e166605eabc11e0d50d.tar.gz
libayylmao-a9e737766d6be3a6ccc43e166605eabc11e0d50d.zip
More POSIX goodness for Makefile
Including using static library archive inference rule
-rw-r--r--Makefile27
1 files changed, 13 insertions, 14 deletions
diff --git a/Makefile b/Makefile
index 24f4b01..c1ab43d 100644
--- a/Makefile
+++ b/Makefile
@@ -1,23 +1,22 @@
+.POSIX:
.PHONY: all install clean
PREFIX = $(HOME)/.local
+ALL = libayylmao.a libayylmao.so
+OBJ = ayy.o lmao.o
-CC = clang
-CFLAGS = -std=c90 -Weverything -fPIC
+all: $(ALL)
-all: libayylmao.a libayylmao.so
-
-install: libayylmao.so libayylmao.a
- mkdir -p -- "$(PREFIX)"/lib "$(PREFIX)"/include "$(PREFIX)"/share/man/man3
- install -m 0644 -- *.h "$(PREFIX)"/include
- install -m 0644 -- *.so *.a "$(PREFIX)"/lib
- install -m 0644 -- *.3 "$(PREFIX)"/share/man/man3
+install: $(ALL)
+ mkdir -p -- $(PREFIX)/lib $(PREFIX)/include $(PREFIX)/share/man/man3
+ cp -- *.h $(PREFIX)/include
+ cp -- *.so *.a $(PREFIX)/lib
+ cp -- *.3 $(PREFIX)/share/man/man3
clean:
- rm -f -- *.a *.o *.so
+ rm -f -- $(ALL) $(OBJ)
-libayylmao.a: ayy.o lmao.o
- ar rcs "$@" ayy.o lmao.o
+libayylmao.a: libayylmao.a(ayy.o) libayylmao.a(lmao.o)
-libayylmao.so: ayy.o lmao.o
- $(CC) $(CFLAGS) -shared -Wl,-soname,"$@" -o "$@" ayy.o lmao.o
+libayylmao.so: $(OBJ)
+ $(CC) $(CFLAGS) -fPIC -shared -Wl,-soname,$@ $(LDFLAGS) -o $@ ayy.o lmao.o