commit 69dd6ac4183d9a09dd8c2688841779dea661cdd2
parent 28095584f05d388a201fb0e531a4ef472d796f2f
Author: Christos Margiolis <christos@margiolis.net>
Date: Sun, 20 Sep 2020 21:51:07 +0300
standardized Makefile
Diffstat:
3 files changed, 23 insertions(+), 18 deletions(-)
diff --git a/Makefile b/Makefile
@@ -1,8 +1,11 @@
-TARGET = graphcurses
-INSTALL_PATH = /usr/local/bin
+BIN = graphcurses
+MAN1 = ${BIN}.1
+PREFIX = /usr/local
+MAN_DIR = ${PREFIX}/man/man1
+BIN_DIR = ${PREFIX}bin
-SRC = $(wildcard *.c)
-OBJ = $(SRC:%.c=%.o)
+SRC = ${wildcard *.c}
+OBJ = ${SRC:%.c=%.o}
CC = gcc
CPPFLAGS += -Iinclude -pedantic -U__STRICT_ANSI__
@@ -10,26 +13,28 @@ CFLAGS += -Wall -std=c99 -O3
LDFLAGS += -Llib
LDLIBS += -lm -lmatheval -lncurses
-CP=cp
-MOVE = mv
-MKDIR_P = mkdir -p
-RM_DIR=rm -rf
+CP=cp -f
+MKDIR = mkdir -p
.PHONY: all clean
-all: $(TARGET)
+all: ${BIN}
-$(TARGET): $(OBJ)
- $(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@
+${BIN}: ${OBJ}
+ ${CC} ${LDFLAGS} $^ ${LDLIBS} -o $@
%.o: %.c
- $(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
+ ${CC} ${CPPFLAGS} ${CFLAGS} -c $< -o $@
run:
- ./$(TARGET)
+ ./${BIN}
-install: $(TARGET)
- $(CP) $(TARGET) $(INSTALL_PATH)
+install: all
+ ${MKDIR} ${DESTDIR}${BIN_DIR}
+ ${CP} ${BIN} ${BIN_DIR}
+ #${MKDIR} ${DESTDIR}${MAN_DIR}
+ #${CP} ${MAN1} ${DESTDIR}${MAN_DIR}
+ #chmod 644 ${DESTDIR}${MAN_DIR}/${MAN1}
clean:
- $(RM) $(OBJ) $(TARGET)
+ ${RM} ${OBJ} ${BIN}
diff --git a/README.md b/README.md
@@ -27,7 +27,7 @@ The binary will be installed at `/usr/local/bin/`
## To Do
-* Improve key handling
+* ~~Improve key handling~~
* Add slope, curvature etc.
* ~~Add an options window~~
* Add coordinates using cursor pointing
diff --git a/graphcurses.c b/graphcurses.c
@@ -248,7 +248,7 @@ int
main(int argc, char **argv)
{
#ifndef NCURSES_VERSION
- fprintf(stderr, "ncurses is needed in order to run this program.\n");
+ fputs("ncurses is needed in order to run this program.\n", stderr);
return EXIT_FAILURE;
#endif /* NCURSES_VERSION */
curses_init();