summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-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