tMakefile: generate library for shared time utility functions - stopwatch - simple timer for console or x root window
(HTM) git clone git://src.adamsgaard.dk/stopwatch
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 1e0f2abc8c9a86278d85ddc424d639343c0359dc
(DIR) parent ef1f4ceda141836715a03af2ef4b4dfa743bc7f3
(HTM) Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Thu, 5 Nov 2020 08:41:05 +0100
Makefile: generate library for shared time utility functions
Diffstat:
M Makefile | 41 +++++++++++++++++++++++++------
1 file changed, 34 insertions(+), 7 deletions(-)
---
(DIR) diff --git a/Makefile b/Makefile
t@@ -8,8 +8,30 @@ PREFIX = /usr/local
MANPREFIX = ${PREFIX}/share/man
DOCPREFIX = ${PREFIX}/share/doc/${NAME}
+RANLIB = ranlib
+
BIN = ${NAME}
+#BIN = \
+# stopwatch\
+# timer
SRC = ${BIN:=.c}
+HDR = timeutil.h
+
+LIBTIMEUTIL = libtimeutil.a
+LIBTIMEUTILSRC = timeutil.c
+LIBTIMEUTILOBJ = ${LIBTIMEUTILSRC:.c=.o}
+
+LIB = ${LIBTIMEUTIL}
+
+X11INC = /usr/X11R6/include
+X11LIB = /usr/X11R6/lib
+INCS = -I${X11INC}
+LIBS = -L${X11LIB} -lX11
+
+STOPWATCHCFLAGS = ${CFLAGS} ${INCS}
+STOPWATCHLDFLAGS = ${LDFLAGS} ${LIBS}
+STOPWATCHCPPFLAGS = ${CPPFLAGS}
+
MAN1 = ${BIN:=.1}
DOC = \
LICENSE\
t@@ -17,26 +39,31 @@ DOC = \
all: ${BIN}
-CFLAGS = -DVERSION=\"${VERSION}\" -I/usr/X11R6/include
-LDFLAGS = -L/usr/X11R6/lib -lX11
+${BIN}: ${LIB} ${@:=.o}
-${BIN}: ${@:=.o}
+OBJ = ${SRC:.c=.o} ${LIBTIMEUTILOBJ}
+
+${OBJ}: ${HDR}
.o:
- ${CC} ${LDFLAGS} -o $@ $<
+ ${CC} ${STOPWATCHLDFLAGS} -o $@ $< ${LIB}
.c.o:
- ${CC} ${CFLAGS} ${CPPFLAGS} -o $@ -c $<
+ ${CC} ${STOPWATCHCFLAGS} ${STOPWATCHCPPFLAGS} -o $@ -c $<
+
+${LIBTIMEUTIL}: ${LIBTIMEUTILOBJ}
+ ${AR} -rc $@ $?
+ ${RANLIB} $@
dist:
rm -rf "${NAME}-${VERSION}"
mkdir -p "${NAME}-${VERSION}"
- cp -f ${MAN1} ${DOC} ${SRC} Makefile "${NAME}-${VERSION}"
+ cp -f ${MAN1} ${DOC} ${SRC} ${LIBTIMEUTILSRC} Makefile "${NAME}-${VERSION}"
tar cf - "${NAME}-${VERSION}" | gzip -c > "${NAME}-${VERSION}.tar.gz"
rm -rf "${NAME}-${VERSION}"
clean:
- rm -f ${BIN} ${OBJ}
+ rm -f ${BIN} ${OBJ} ${LIB}
install:
# installing executable files.