st-custom/Makefile

76 lines
2.3 KiB
Makefile

# st - simple terminal
# See LICENSE file for copyright and license details.
.PHONY: all clean install uninstall
.POSIX:
include config.mk
SRC = st.c x.c $(LIGATURES_C) $(SIXEL_C)
OBJ = $(SRC:.c=.o)
all: st terminfo
# TODO: Update command to update submodules
clean:
find . -maxdepth 1 -type f | grep -Pv "^\./\.|Makefile$$" | xargs -r rm
rm -r tmp patch terminfo 2>/dev/null || true
git -C st-flexipatch reset --hard HEAD
git -C st-flexipatch clean -fdx
buildroot:
cp config/patches.h st-flexipatch/patches.h
flexipatch-finalizer/flexipatch-finalizer.sh -r -d st-flexipatch -o tmp
rm -r tmp/Makefile
mv tmp/* ./
for patch in config/patches/*.diff; do patch <"$$patch"; done
config.mk:
cp config/config.mk ./config.mk
config.h:
cp config/config.h ./config.h
*.c: buildroot
*.h: buildroot
.c.o:
$(CC) $(STCFLAGS) -c $<
st.o: buildroot config.h st.h win.h
x.o: buildroot arg.h config.h st.h win.h $(LIGATURES_H)
$(OBJ): config.h config.mk buildroot
st: buildroot $(OBJ)
$(CC) -o $@ $(OBJ) $(STLDFLAGS)
terminfo: buildroot
tic -sx -o terminfo st.info
install: st terminfo
mkdir -p $(DESTDIR)$(PREFIX)/bin
cp -f st $(DESTDIR)$(PREFIX)/bin
chmod 755 $(DESTDIR)$(PREFIX)/bin/st
mkdir -p $(DESTDIR)$(MANPREFIX)/man1
sed "s/VERSION/$(VERSION)/g" < st.1 > $(DESTDIR)$(MANPREFIX)/man1/st.1
chmod 644 $(DESTDIR)$(MANPREFIX)/man1/st.1
mkdir -p $(DESTDIR)$(PREFIX)/share
cp -a terminfo $(DESTDIR)$(PREFIX)/share/terminfo
chmod 755 $(DESTDIR)$(PREFIX)/share/terminfo/s
chmod 644 $(DESTDIR)$(PREFIX)/share/terminfo/s/st-*
# mkdir -p $(DESTDIR)$(PREFIX)/share/applications # desktop-entry patch
# test -f ${DESTDIR}${PREFIX}/share/applications/st.desktop || cp -n st.desktop $(DESTDIR)$(PREFIX)/share/applications # desktop-entry patch
uninstall:
rm -f $(DESTDIR)$(PREFIX)/bin/st
rm -f $(DESTDIR)$(MANPREFIX)/man1/st.1
rm -f $(DESTDIR)$(PREFIX)/share/applications/st.desktop # desktop-entry patch
rm -f $(DESTDIR)$(PREFIX)/share/terminfo/s/st
rm -f $(DESTDIR)$(PREFIX)/share/terminfo/s/st-256color
rm -f $(DESTDIR)$(PREFIX)/share/terminfo/s/st-bs
rm -f $(DESTDIR)$(PREFIX)/share/terminfo/s/st-bs-256color
rm -f $(DESTDIR)$(PREFIX)/share/terminfo/s/st-meta
rm -f $(DESTDIR)$(PREFIX)/share/terminfo/s/st-meta-256color
rm -f $(DESTDIR)$(PREFIX)/share/terminfo/s/st-mono