aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorAlessandro Iezzi <aiezzi@alessandroiezzi.it>2023-02-03 18:40:59 +0100
committerAlessandro Iezzi <aiezzi@alessandroiezzi.it>2023-02-03 18:40:59 +0100
commit51c05fe7b5d6518bfb8a07ee3ec3c072bb21163e (patch)
tree92a52dc4849fbeb2566f8e87a88ff3ec02e5f75e /Makefile
downloadstring2-51c05fe7b5d6518bfb8a07ee3ec3c072bb21163e.tar.gz
string2-51c05fe7b5d6518bfb8a07ee3ec3c072bb21163e.zip
Initial commit
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile33
1 files changed, 33 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..b3f85e3
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,33 @@
+# See LICENSE file for copyright and license details.
+
+CC = cc
+SRC != find src -name '*.c'
+OBJ = ${SRC:.c=.o}
+
+LIBNAME = libstr
+
+CFLAGS = -Wall -ansi --std=c89 -pedantic ${OPT}
+LDFLAGS =
+
+dist:
+ @make OPT='-O2 -pipe -Werror' all
+
+debug:
+ @make OPT=-g all
+
+all: ${LIBNAME:=.so} ${LIBNAME:=.a}
+
+${LIBNAME:=.so}: ${OBJ}
+ ${CC} ${LDFLAGS} -fPIC -shared ${OBJ} -o $@
+
+${LIBNAME:=.a}: ${OBJ}
+ ar rcs $@ ${OBJ}
+
+.c.o:
+ ${CC} ${CFLAGS} -fPIC -c $< -o $@
+
+clean:
+ rm -f ${OBJ} ${LIBNAME}.* *.core
+
+tests: all
+ cd test && make clean tests