commit ad15460f1bcc0cf807e79f19de8b19b3801d66db
parent 69dd6ac4183d9a09dd8c2688841779dea661cdd2
Author: Christos Margiolis <christos@margiolis.net>
Date: Thu, 15 Oct 2020 00:00:21 +0300
added LICENSE and updated Makefile
Diffstat:
A | LICENSE | | | 29 | +++++++++++++++++++++++++++++ |
M | Makefile | | | 43 | +++++++++++++++++++++++++++++++------------ |
2 files changed, 60 insertions(+), 12 deletions(-)
diff --git a/LICENSE b/LICENSE
@@ -0,0 +1,29 @@
+BSD 3-Clause License
+
+Copyright (c) 2020-present, Christos Margiolis.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+* Neither the name of images.weserv.nl nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/Makefile b/Makefile
@@ -1,40 +1,59 @@
BIN = graphcurses
+VERSION = 0.1
+DIST = ${BIN}-${VERSION}
MAN1 = ${BIN}.1
PREFIX = /usr/local
MAN_DIR = ${PREFIX}/man/man1
BIN_DIR = ${PREFIX}bin
-SRC = ${wildcard *.c}
-OBJ = ${SRC:%.c=%.o}
+EXT = c
+SRC = ${wildcard *.${EXT}}
+OBJ = ${SRC:%.${EXT}=%.o}
CC = gcc
-CPPFLAGS += -Iinclude -pedantic -U__STRICT_ANSI__
-CFLAGS += -Wall -std=c99 -O3
+CPPFLAGS += -Iinclude -U__STRICT_ANSI__ -DVERSION=\"${VERSION}\"
+CFLAGS += -Wall -std=c99 -pedantic -O3
LDFLAGS += -Llib
LDLIBS += -lm -lmatheval -lncurses
-CP=cp -f
+CP = cp -f
+RM = rm -f
+RM_DIR = rm -rf
MKDIR = mkdir -p
-
-.PHONY: all clean
+TAR = tar -cf
+GZIP = gzip
all: ${BIN}
${BIN}: ${OBJ}
${CC} ${LDFLAGS} $^ ${LDLIBS} -o $@
-%.o: %.c
+%.o: %.${EXT}
${CC} ${CPPFLAGS} ${CFLAGS} -c $< -o $@
+dist: clean
+ ${MKDIR} ${DIST}
+ ${CP} -R ${SRC} LICENSE Makefile README.md ${DIST}
+ ${TAR} ${DIST}.tar ${DIST}
+ ${GZIP} ${DIST}.tar
+ ${RM_DIR} ${DIST}
+
run:
./${BIN}
install: all
- ${MKDIR} ${DESTDIR}${BIN_DIR}
+ ${MKDIR} ${DESTDIR}${BIN_DIR} ${DESTDIR}${MAN_DIR}
${CP} ${BIN} ${BIN_DIR}
- #${MKDIR} ${DESTDIR}${MAN_DIR}
- #${CP} ${MAN1} ${DESTDIR}${MAN_DIR}
- #chmod 644 ${DESTDIR}${MAN_DIR}/${MAN1}
+ ${CP} ${MAN1} ${DESTDIR}${MAN_DIR}
+ sed "s/VERSION/${VERSION}/g" < ${MAN1} > ${DESTDIR}${MAN_DIR}/${MAN1}
+ chmod 644 ${DESTDIR}${BIN_DIR}/${BIN}
+ chmod 644 ${DESTDIR}${MAN_DIR}/${MAN1}
+
+uninstall: all
+ ${RM} ${DESTDIR}${BIN_DIR}/${BIN}
+ ${RM} ${DESTDIR}${MAN_DIR}/${MAN1}
clean:
${RM} ${OBJ} ${BIN}
+
+.PHONY: all clean dist install uninstall run