aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlessandro Iezzi <aiezzi@alessandroiezzi.it>2023-02-03 22:04:00 +0100
committerAlessandro Iezzi <aiezzi@alessandroiezzi.it>2023-02-03 22:04:00 +0100
commitfc0ab4bf125b5082debbf7ad04ea5f3b7575c268 (patch)
tree4ea6868fa918123744f18515034fcae411bfe920
parent8fba1b132e14e2aa6e64aa2c8291a033bdb150e4 (diff)
downloadlog-fc0ab4bf125b5082debbf7ad04ea5f3b7575c268.tar.gz
log-fc0ab4bf125b5082debbf7ad04ea5f3b7575c268.zip
Edit Makefile in order to compile and execute tests
-rw-r--r--Makefile30
1 files changed, 15 insertions, 15 deletions
diff --git a/Makefile b/Makefile
index 136357f..3b17c80 100644
--- a/Makefile
+++ b/Makefile
@@ -1,34 +1,34 @@
# See LICENSE file for copyright and license details.
CC = cc
-SRC = log.c
+SRC != find src -name "*.c"
OBJ = ${SRC:.c=.o}
LIBNAME = liblog
-CFLAGS = -O2 -pipe -Wall -Werror --std=c89 -ansi -pedantic
+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}
-all: ${LIBNAME:=.so} ${LIBNAME:=.a} test-app
-
.c.o:
- ${CC} ${CFLAGS} -fPIC -c $<
-
-all: ${LIBNAME:=.so} ${LIBNAME:=.a}
+ ${CC} ${CFLAGS} -fPIC -c $< -o $@
clean:
- rm -f *.o ${LIBNAME}.* test-app *.core
-
-
-# Targets for testing application
-main.o:
- ${CC} ${CFLAGS} -c $<
+ rm -f ${OBJ} ${LIBNAME}.* *.core
+ cd test && make clean
-test-app: main.o ${OBJ}
- ${CC} ${LDFLAGS} -o $@ main.o ${OBJ}
+tests: all
+ cd test && make clean tests