~crm/cstring

999f91450796c7a6ed97f8d6bc9751c9a88d4742 — Christos Margiolis 3 years ago 9cac873
removed wildcards
2 files changed, 47 insertions(+), 45 deletions(-)

M Makefile
M tests/Makefile
M Makefile => Makefile +27 -25
@@ 10,8 10,10 @@ INC_DIR = ${PREFIX}/include
LIB_DIR = ${PREFIX}/lib

EXT = c
SRC = ${wildcard *.${EXT}}
OBJ = ${SRC:%.${EXT}=%.o}
#SRC = ${wildcard *.${EXT}}
#OBJ = ${SRC:%.${EXT}=%.o}
SRC = cstring.c
OBJ = cstring.o

AR = ar
ARFLAGS = rs


@@ 33,40 35,40 @@ GZIP = gzip
all: options ${LIB}

options:
		@echo ${LIB} build options:
		@echo "CFLAGS   = ${CFLAGS}"
		@echo "LDFLAGS  = ${LDFLAGS}"
		@echo "CC       = ${CC}"
	@echo ${LIB} build options:
	@echo "CFLAGS   = ${CFLAGS}"
	@echo "LDFLAGS  = ${LDFLAGS}"
	@echo "CC       = ${CC}"

${LIB}: ${OBJ}
		${AR} ${ARFLAGS} lib${LIB}.a ${OBJ}
	${AR} ${ARFLAGS} lib${LIB}.a ${OBJ}

${OBJ}: ${SRC}
		${CC} ${CFLAGS} -c $< -o $@
	${CC} ${CFLAGS} -c ${SRC} -o $@

dist: clean
		${MKDIR} ${DIST}
		${CP} -R tests ${SRC} ${MAN3} LICENSE Makefile README.md ${DIST}
		${TAR} ${DIST}.tar ${DIST}
		${GZIP} ${DIST}.tar
		${RM_DIR} ${DIST}
	${MKDIR} ${DIST}
	${CP} -R tests ${SRC} ${MAN3} LICENSE Makefile README.md ${DIST}
	${TAR} ${DIST}.tar ${DIST}
	${GZIP} ${DIST}.tar
	${RM_DIR} ${DIST}

install: all
		${MKDIR} ${DESTDIR}${LIB_DIR} ${DESTDIR}${INC_DIR} ${DESTDIR}${MAN_DIR}
		${CP} ${LIB}.h ${DESTDIR}${INC_DIR}
		${CP} lib${LIB}.a ${DESTDIR}${LIB_DIR}
		${CP} ${MAN3} ${DESTDIR}${MAN_DIR}
		sed "s/VERSION/${VERSION}/g" < ${MAN3} > ${DESTDIR}${MAN_DIR}/${MAN3}
		chmod 755 ${DESTDIR}${INC_DIR}/${LIB}.h
		chmod 644 ${DESTDIR}${LIB_DIR}/lib${LIB}.a
		chmod 644 ${DESTDIR}${MAN_DIR}/${MAN3}
	${MKDIR} ${DESTDIR}${LIB_DIR} ${DESTDIR}${INC_DIR} ${DESTDIR}${MAN_DIR}
	${CP} ${LIB}.h ${DESTDIR}${INC_DIR}
	${CP} lib${LIB}.a ${DESTDIR}${LIB_DIR}
	${CP} ${MAN3} ${DESTDIR}${MAN_DIR}
	sed "s/VERSION/${VERSION}/g" < ${MAN3} > ${DESTDIR}${MAN_DIR}/${MAN3}
	chmod 755 ${DESTDIR}${INC_DIR}/${LIB}.h
	chmod 644 ${DESTDIR}${LIB_DIR}/lib${LIB}.a
	chmod 644 ${DESTDIR}${MAN_DIR}/${MAN3}

uninstall:
		${RM} ${DESTDIR}${INC_DIR}/${LIB}.h
		${RM} ${DESTDIR}${LIB_DIR}/lib${LIB}.a
		${RM} ${DESTDIR}${MAN_DIR}/${MAN3}
	${RM} ${DESTDIR}${INC_DIR}/${LIB}.h
	${RM} ${DESTDIR}${LIB_DIR}/lib${LIB}.a
	${RM} ${DESTDIR}${MAN_DIR}/${MAN3}

clean:
		${RM} ${LIB} ${OBJ} lib${LIB}.a ${DIST}.tar.gz
	${RM} ${LIB} ${OBJ} lib${LIB}.a ${DIST}.tar.gz

.PHONY: all options clean dist install uninstall

M tests/Makefile => tests/Makefile +20 -20
@@ 6,33 6,33 @@ LDFLAGS = -Llib -lcstring
all: options ${BINS}

options:
		@echo "build options:"
		@echo "CFLAGS   = ${CFLAGS}"
		@echo "LDFLAGS  = ${LDFLAGS}"
		@echo "CC       = ${CC}"
	@echo "build options:"
	@echo "CFLAGS   = ${CFLAGS}"
	@echo "LDFLAGS  = ${LDFLAGS}"
	@echo "CC       = ${CC}"

run:
		@echo "---------------------------"
		@echo "---------------------------"
		@echo "RUNNING: test_basic"
		@echo "---------------------------"
		@echo "---------------------------"
		./test_basic
		
		@echo "---------------------------"
		@echo "---------------------------"
		@echo "RUNNING: test_insert"
		@echo "---------------------------"
		@echo "---------------------------"
		./test_insert
	@echo "---------------------------"
	@echo "---------------------------"
	@echo "RUNNING: test_basic"
	@echo "---------------------------"
	@echo "---------------------------"
	./test_basic
	
	@echo "---------------------------"
	@echo "---------------------------"
	@echo "RUNNING: test_insert"
	@echo "---------------------------"
	@echo "---------------------------"
	./test_insert

clean:
		rm -f ${BINS} *.o
	rm -f ${BINS} *.o

test_basic: test_basic.c
		${CC} test_basic.c ${CFLAGS} -o test_basic ${LDFLAGS}
	${CC} test_basic.c ${CFLAGS} -o test_basic ${LDFLAGS}

test_insert: test_insert.c
		${CC} test_insert.c ${CFLAGS} -o test_insert ${LDFLAGS}
	${CC} test_insert.c ${CFLAGS} -o test_insert ${LDFLAGS}

.PHONY: all options run clean