diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..2eadf5e --- /dev/null +++ b/Makefile @@ -0,0 +1,64 @@ +# dmenu - dynamic menu +# See LICENSE file for copyright and license details. +.PHONY: all clean dist install uninstall + +include config.mk + +SRC = drw.c dmenu.c stest.c util.c +OBJ = $(SRC:.c=.o) + +all: dmenu stest + +.c.o: + $(CC) -c $(CFLAGS) $< + +config.h: + cp config.def.h $@ + +config.mk: + cp config/config.mk config.mk + +${SRC}: buildroot + +$(OBJ): arg.h config.h config.mk drw.h + +stest: stest.o + $(CC) -o $@ stest.o $(LDFLAGS) + +dmenu: dmenu.o drw.o util.o + $(CC) -o $@ dmenu.o drw.o util.o $(LDFLAGS) + +clean: + find . -maxdepth 1 -type f | grep -Pv "^\./\.|Makefile$$" | xargs -r rm + rm -r tmp patch 2>/dev/null || true + git -C dmenu-flexipatch reset --hard HEAD + git -C dmenu-flexipatch clean -ffdx + +buildroot: + cp config/patches.h dmenu-flexipatch/patches.h + flexipatch-finalizer/flexipatch-finalizer.sh -r -d dmenu-flexipatch -o tmp + rm -r tmp/Makefile tmp/config.mk patch 2>/dev/null || true + mv tmp/* ./ + rmdir tmp + +install: all + mkdir -p $(DESTDIR)$(PREFIX)/bin + cp -f dmenu dmenu_path dmenu_run stest $(DESTDIR)$(PREFIX)/bin + chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu + chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu_path + chmod 755 $(DESTDIR)$(PREFIX)/bin/dmenu_run + chmod 755 $(DESTDIR)$(PREFIX)/bin/stest + mkdir -p $(DESTDIR)$(MANPREFIX)/man1 + sed "s/VERSION/$(VERSION)/g" < dmenu.1 > $(DESTDIR)$(MANPREFIX)/man1/dmenu.1 + sed "s/VERSION/$(VERSION)/g" < stest.1 > $(DESTDIR)$(MANPREFIX)/man1/stest.1 + chmod 644 $(DESTDIR)$(MANPREFIX)/man1/dmenu.1 + chmod 644 $(DESTDIR)$(MANPREFIX)/man1/stest.1 + +uninstall: + rm -f $(DESTDIR)$(PREFIX)/bin/dmenu\ + $(DESTDIR)$(PREFIX)/bin/dmenu_path\ + $(DESTDIR)$(PREFIX)/bin/dmenu_run\ + $(DESTDIR)$(PREFIX)/bin/stest\ + $(DESTDIR)$(MANPREFIX)/man1/dmenu.1\ + $(DESTDIR)$(MANPREFIX)/man1/stest.1 + diff --git a/build.sh b/build.sh deleted file mode 100755 index ebc2a8b..0000000 --- a/build.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -cp config.mk patches.h dmenu-flexipatch/ -flexipatch-finalizer/flexipatch-finalizer.sh -r -d dmenu-flexipatch -o dmenu-final -git -C dmenu-flexipatch reset --hard HEAD && git -C dmenu-flexipatch clean -fd -# for patch in patches/*.diff; do -# patch -d dmenu-final <"$patch" -# done -cp config.h dmenu-final/ -cd dmenu-final || exit 1 -if [ "$1" = "-i" ]; then - sudo make install -else - make -fi diff --git a/config.h b/config/config.h similarity index 100% rename from config.h rename to config/config.h diff --git a/config.mk b/config/config.mk similarity index 100% rename from config.mk rename to config/config.mk diff --git a/patches.h b/config/patches.h similarity index 100% rename from patches.h rename to config/patches.h