diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 44 |
1 files changed, 30 insertions, 14 deletions
@@ -1,35 +1,51 @@ # See LICENSE file for copyright and license details. +include config.mk + CC = cc -SRC != find src -name '*.c' + +# Used for debugging and not as usual OBJ = ${SRC:.c=.o} LIBNAME = libstr LIBVER = 0.0.0-a1 -CFLAGS = -Wall -ansi --std=c89 -pedantic ${OPT} -DLIBVER=\"${LIBVER}\" +OPTIM = -O2 -pipe +STD = -ansi --std=c89 -pedantic +WARNS = -Werror -Wall + LDFLAGS = +CFLAGS = ${WARNS} ${STD} -DLIBVER=\"${LIBVER}\" ${OPTIM} -dist: - @make OPT='-O2 -pipe -Werror' all +# CFLAGS for debugging +CDFLAGS = ${WARNS} ${STD} -DLIBVER=\"${LIBVER}\" -g -debug: - @make OPT=-g all +all: ${LIBNAME:=.a} ${LIBNAME:=.so} + @echo ${STD}. -all: ${LIBNAME:=.so} ${LIBNAME:=.a} +debug: ${OBJ} -${LIBNAME:=.so}: ${OBJ} - ${CC} ${LDFLAGS} -fPIC -shared ${OBJ} -o $@ +.c.o: + ${CC} ${CDFLAGS} -c $< -o $@ -${LIBNAME:=.a}: ${OBJ} - ar rcs $@ ${OBJ} +# Make shared and archive directories +${ARDIR} ${SHDIR}: + mkdir -p $@ -.c.o: - ${CC} ${CFLAGS} -fPIC -c $< -o $@ +# Make archive file +${LIBNAME:=.a}: ${ARDIR} ${AROBJ} + ar rcs $@ ${AROBJ} + +# Make shared file +${LIBNAME:=.so}: ${SHDIR} ${SHOBJ} + ${CC} ${LDFLAGS} -shared ${SHOBJ} -o $@ clean: - rm -f ${OBJ} ${LIBNAME}.* *.core + rm -rf bin ${LIBNAME}.* *.core ${OBJ} cd test && make clean tests: all cd test && make clean tests + +# Generated by makemk script +include target.mk |