st-custom/Makefile

76 lines
2.3 KiB
Makefile
Raw Normal View History

2024-01-29 18:29:18 +01:00
# st - simple terminal
# See LICENSE file for copyright and license details.
2024-05-17 12:03:44 +02:00
.PHONY: all clean install uninstall
2024-01-29 18:29:18 +01:00
.POSIX:
include config.mk
SRC = st.c x.c $(LIGATURES_C) $(SIXEL_C)
OBJ = $(SRC:.c=.o)
2024-05-17 12:03:44 +02:00
all: st terminfo
2024-01-29 18:29:18 +01:00
2024-05-17 12:03:44 +02:00
# 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
2024-01-29 18:29:18 +01:00
2024-05-17 12:03:44 +02:00
config.h:
cp config/config.h ./config.h
2024-05-17 12:03:44 +02:00
*.c: buildroot
*.h: buildroot
2024-01-29 18:29:18 +01:00
.c.o:
$(CC) $(STCFLAGS) -c $<
2024-05-17 12:03:44 +02:00
st.o: buildroot config.h st.h win.h
x.o: buildroot arg.h config.h st.h win.h $(LIGATURES_H)
2024-01-29 18:29:18 +01:00
2024-05-17 12:03:44 +02:00
$(OBJ): config.h config.mk buildroot
2024-01-29 18:29:18 +01:00
2024-05-17 12:03:44 +02:00
st: buildroot $(OBJ)
2024-01-29 18:29:18 +01:00
$(CC) -o $@ $(OBJ) $(STLDFLAGS)
2024-05-17 12:03:44 +02:00
terminfo: buildroot
2024-04-25 14:23:23 +02:00
tic -sx -o terminfo st.info
2024-05-17 12:03:44 +02:00
install: st terminfo
2024-01-29 18:29:18 +01:00
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
2024-04-25 14:23:23 +02:00
mkdir -p $(DESTDIR)$(PREFIX)/share
cp -a terminfo $(DESTDIR)$(PREFIX)/share/terminfo
2024-05-17 12:03:44 +02:00
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
2024-05-17 12:03:44 +02:00
2024-01-29 18:29:18 +01:00
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
2024-04-25 14:23:23 +02:00
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