summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2016-03-22 19:22:47 +1300
committerTom Ryder <tom@sanctum.geek.nz>2016-03-22 19:22:47 +1300
commitf2fbd5e717306bd65603c466c045b88b410947cf (patch)
tree737d1b5eec4287adf1ddcca68577d008d7d88d40
downloadlibayylmao-f2fbd5e717306bd65603c466c045b88b410947cf.tar.gz
libayylmao-f2fbd5e717306bd65603c466c045b88b410947cf.zip
First commit of libayylmao
-rw-r--r--Makefile22
-rw-r--r--ayy.c7
-rw-r--r--ayylmao.h10
-rw-r--r--lmao.c7
4 files changed, 46 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..d0f966f
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,22 @@
+.PHONY: all install clean
+
+PREFIX = $(HOME)/.local
+
+CC = clang
+CFLAGS = -std=c90 -Weverything -fPIC
+
+all: libayylmao.a libayylmao.so
+
+install: libayylmao.so libayylmao.a
+ mkdir -p -- $(PREFIX)/lib $(PREFIX)/include
+ install -- ayylmao.h $(PREFIX)/include
+ install -- libayylmao.so libayylmao.a $(PREFIX)/lib
+
+clean:
+ rm -f -- *.a *.o *.so
+
+libayylmao.a: ayy.o lmao.o
+ ar rcs "$@" ayy.o lmao.o
+
+libayylmao.so: ayy.o lmao.o
+ $(CC) $(CFLAGS) -shared -Wl,-soname,"$@" -o "$@" ayy.o lmao.o
diff --git a/ayy.c b/ayy.c
new file mode 100644
index 0000000..a505377
--- /dev/null
+++ b/ayy.c
@@ -0,0 +1,7 @@
+#include "ayylmao.h"
+
+/* Print "ayy" to stdout */
+void ayy(void) {
+ fprintf(stdout, "%s\n", AYY);
+ return;
+}
diff --git a/ayylmao.h b/ayylmao.h
new file mode 100644
index 0000000..bfb7088
--- /dev/null
+++ b/ayylmao.h
@@ -0,0 +1,10 @@
+/* Require libc printf() */
+#include <stdio.h>
+
+/* Translation macros for "ayy" and "lmao" */
+#define AYY "ayy"
+#define LMAO "lmao"
+
+/* Function prototypes */
+void ayy(void);
+void lmao(void);
diff --git a/lmao.c b/lmao.c
new file mode 100644
index 0000000..1fdcf51
--- /dev/null
+++ b/lmao.c
@@ -0,0 +1,7 @@
+#include "ayylmao.h"
+
+/* Print "lmao" to stdout */
+void lmao(void) {
+ fprintf(stdout, "%s\n", LMAO);
+ return;
+}