no-more-secrets: Build both with and without ncurses

This commit is contained in:
Tee KOBAYASHI 2022-01-09 02:00:37 +09:00 committed by Henrik Grimler
parent ee828210af
commit dd5aea75bc
2 changed files with 20 additions and 9 deletions

View File

@ -1,23 +1,32 @@
--- a/Makefile --- a/Makefile
+++ b/Makefile +++ b/Makefile
@@ -14,6 +14,7 @@ @@ -15,23 +15,25 @@
CC ?= gcc CC ?= gcc
CFLAGS ?= -Wextra -Wall -O2 CFLAGS ?= -Wextra -Wall -O2
+LDFLAGS ?= -lncursesw
+NCURSES_LIBS ?= -lncursesw
+
.PHONY: all install uninstall clean .PHONY: all install uninstall clean
@@ -28,10 +29,10 @@ nms: $(OBJ)/input.o $(OBJ)/error.o $(OBJ)/nmscharset.o $(OBJ)/nmstermio.o $(OBJ)/nmseffect.o $(OBJ)/nms.o | $(BIN)
- $(CC) $(CFLAGS) -o $(BIN)/$@ $^
+ $(CC) $(CFLAGS) -o $(BIN)/$@ $^ $(LDFLAGS)
sneakers: $(OBJ)/nmscharset.o $(OBJ)/nmstermio.o $(OBJ)/nmseffect.o $(OBJ)/sneakers.o | $(BIN)
- $(CC) $(CFLAGS) -o $(BIN)/$@ $^
+ $(CC) $(CFLAGS) -o $(BIN)/$@ $^ $(LDFLAGS)
all: nms sneakers
all-ncurses: nms-ncurses sneakers-ncurses all-ncurses: nms-ncurses sneakers-ncurses
nms-ncurses: $(OBJ)/input.o $(OBJ)/error.o $(OBJ)/nmscharset.o $(OBJ)/nmstermio_ncurses.o $(OBJ)/nmseffect.o $(OBJ)/nms.o | $(BIN) nms-ncurses: $(OBJ)/input.o $(OBJ)/error.o $(OBJ)/nmscharset.o $(OBJ)/nmstermio_ncurses.o $(OBJ)/nmseffect.o $(OBJ)/nms.o | $(BIN)
- $(CC) $(CFLAGS) -o $(BIN)/nms $^ -lncursesw - $(CC) $(CFLAGS) -o $(BIN)/nms $^ -lncursesw
+ $(CC) $(CFLAGS) -o $(BIN)/nms $^ $(LDFLAGS) + $(CC) $(CFLAGS) $(NCURSES_CFLAGS) -o $(BIN)/nms-ncurses $^ $(LDFLAGS) $(NCURSES_LIBS)
sneakers-ncurses: $(OBJ)/nmscharset.o $(OBJ)/nmstermio_ncurses.o $(OBJ)/nmseffect.o $(OBJ)/sneakers.o | $(BIN) sneakers-ncurses: $(OBJ)/nmscharset.o $(OBJ)/nmstermio_ncurses.o $(OBJ)/nmseffect.o $(OBJ)/sneakers.o | $(BIN)
- $(CC) $(CFLAGS) -o $(BIN)/sneakers $^ -lncursesw - $(CC) $(CFLAGS) -o $(BIN)/sneakers $^ -lncursesw
+ $(CC) $(CFLAGS) -o $(BIN)/sneakers $^ $(LDFLAGS) + $(CC) $(CFLAGS) $(NCURSES_CFLAGS) -o $(BIN)/sneakers-ncurses $^ $(LDFLAGS) $(NCURSES_LIBS)
$(OBJ)/%.o: $(SRC)/%.c | $(OBJ) $(OBJ)/%.o: $(SRC)/%.c | $(OBJ)
$(CC) $(CFLAGS) -o $@ -c $< $(CC) $(CFLAGS) -o $@ -c $<

View File

@ -3,13 +3,15 @@ TERMUX_PKG_DESCRIPTION="This project provides a command line tool called nms tha
TERMUX_PKG_LICENSE="GPL-3.0" TERMUX_PKG_LICENSE="GPL-3.0"
TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=1.0.1 TERMUX_PKG_VERSION=1.0.1
TERMUX_PKG_REVISION=1
TERMUX_PKG_SRCURL=https://github.com/bartobri/no-more-secrets/archive/refs/tags/v${TERMUX_PKG_VERSION}.tar.gz TERMUX_PKG_SRCURL=https://github.com/bartobri/no-more-secrets/archive/refs/tags/v${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=4422e59bb3cf62bca3c73d1fdae771b83aab686cd044f73fe14b1b9c2af1cb1b TERMUX_PKG_SHA256=4422e59bb3cf62bca3c73d1fdae771b83aab686cd044f73fe14b1b9c2af1cb1b
TERMUX_PKG_DEPENDS="libandroid-support, ncurses" TERMUX_PKG_DEPENDS="libandroid-support, ncurses"
TERMUX_PKG_BUILD_IN_SRC=true TERMUX_PKG_BUILD_IN_SRC=true
TERMUX_PKG_EXTRA_MAKE_ARGS="all-ncurses" TERMUX_PKG_EXTRA_MAKE_ARGS="all all-ncurses"
termux_step_pre_configure() { termux_step_pre_configure() {
CFLAGS+=" $(pkg-config --cflags ncurses)" CFLAGS+=" $CPPFLAGS"
LDFLAGS+=" $(pkg-config --libs ncurses)" export NCURSES_CFLAGS="$(pkg-config --cflags ncurses)"
export NCURSES_LIBS="$(pkg-config --libs ncurses)"
} }