Commit Diff
Commit:
fd3ba448dccd71ffa0e7dd708fdb6bd2e021203d
From:
Omar Polo <op@omarpolo.com>
Date:
Mon May 16 21:25:32 2022 UTC
Message
rework the build system and bump version let's use OpenBSD' bsd.xconf.mk and bsd.prog.mk
commit - 56ee7df94d001a3406af2707a4280b1fbe8cd54d
commit + fd3ba448dccd71ffa0e7dd708fdb6bd2e021203d
blob - 83cd59c6746c9a2ee1f11144e3ae8026adb4a1e9
blob + d3085e47931b013ea05779cffd60cd434b8a97f8
--- Makefile
+++ Makefile
@@ -1,44 +1,45 @@
-VERSION = 0.1
+.include <bsd.xconf.mk>
-# you may want to change these
-OPTIONAL = xinerama xft
-CDEFS = -DUSE_XINERAMA -DUSE_XFT -DUSE_STRCASESTR
+PROG = mymenu
-# you may not want to change these
-CC ?= cc
-LIBS = `pkg-config --libs x11 $(OPTIONAL)`
-OPTIM = -O3
-CFLAGS = $(CDEFS) -DVERSION=\"$(VERSION)\" `pkg-config --cflags x11 $(OPTIONAL)`
+.include "mymenu-version.mk"
-.PHONY: all clean install debug no_xft no_xinerama no_xft_xinerama gnu manpage
+CPPFLAGS += -I${X11BASE}/include -I${X11BASE}/include/freetype2 -DVERSION=\"${MYMENU_VERSION}\"
+LDADD = -L${X11BASE}/lib -lX11 -lXinerama -lXft
-all: mymenu
+.if "${MYMENU_RELEASE}" == "Yes"
+PREFIX ?= /usr/local
+BINDIR ?= ${PREFIX}/bin
+MANDIR ?= ${PREFIX}/man/man
+.else
+NOMAN = Yes
+CFLAGS += -Werror -Wall -Wstrict-prototypes -Wunused-variable
+PREFIX ?= ${HOME}
+BINDIR ?= ${PREFIX}/bin
+BINOWN = ${USER}
+BINGRP != id -g -n
+DEBUG = -O0 -g
+.endif
-mymenu: mymenu.c
- $(CC) $(CFLAGS) mymenu.c -o mymenu $(LIBS) $(OPTIM)
+release: clean
+ sed -i -e 's/_RELEASE=No/_RELEASE=Yes/' mymenu-version.mk
+ ${MAKE} dist
+ sed -i -e 's/_RELEASE=Yes/_RELEASE=No/' mymenu-version.mk
-manpage: mymenu.1.md
+dist: clean
+ find . -type -d -name obj -delete
+ mkdir /tmp/mymenu-${MYMENU_VERSION}
+ pax -rw * /tmp/mymenu-${MYMENU_VERSION}
+ rm /tmp/mymenu-${MYMENU_VERSION}/mymenu-dist.txt
+ tar -C /tmp -zcf mymenu-${MYMENU_VERSION}.tar.gz mymenu-${MYMENU_VERSION}
+ rm -rf /tmp/mymenu-${MYMENU_VERSION}
+ tar -ztf mymenu-${MYMENU_VERSION}.tar.gz |
+ sed -e 's/^mymenu-${MYMENU_VERSION}//' |
+ sort > mymenu-dist.txt.new
+ diff -u mymenu-dist.txt{,.new}
+ rm mymenu-dist.txt.new
mymenu.1.md: mymenu.1
mandoc -T markdown mymenu.1 > mymenu.1.md
-gnu: mymenu.c
- make CDEFS="-D_GNU_SOURCE $(CDEFS)"
-
-debug:
- make OPTIM="-g -O0 -Wall"
-
-no_xft: mymenu.c
- make OPTIONAL="xinerama" CDEFS="-DUSE_XINERAMA -DUSE_STRCASESTR"
-
-no_xinerama: mymenu.c
- make OPTIONAL="xft" CDEFS="-DUSE_XFT -DUSE_STRCASESTR"
-
-no_xft_xinerama: mymenu.c
- make OPTIONAL="" CDEFS="-DUSE_STRCASESTR"
-
-clean:
- rm -f mymenu
-
-install: mymenu
- cp mymenu ~/bin
+.include <bsd.prog.mk>
blob - /dev/null
blob + 0ed6331aeb02b9a0c1057ad4b7b7d886be43a893 (mode 644)
--- /dev/null
+++ mymenu-version.mk
@@ -0,0 +1,8 @@
+MYMENU_RELEASE=No
+MYMENU_VERSION_NUMBER=0.2
+
+.if ${MYMENU_RELEASE} == Yes
+MYMENU_VERSION=${MYMENU_VERSION_NUMBER}
+.else
+MYMENU_VERSION=${MYMENU_VERSION_NUMBER}-current
+.endif
Omar Polo