# Makefile for uxd, by B. Watson. WTFPL. # Tested with GNU make, BSD make, makepp, and Schily's dmake and smake. ### Override these variables as needed. Don't override CFLAGS; use # MYCFLAGS instead. MYCFLAGS=-O2 -fPIC LDFLAGS= LIBS= RST2MAN=rst2man # These only affect the 'install' target (they don't get compiled # into the binary). PREFIX=/usr MANDIR=$(PREFIX)/man MAN1DIR=$(MANDIR)/man1 BINDIR=$(PREFIX)/bin DESTDIR= INSTALL_DATA=install -m0644 INSTALL_PROGRAM=install -s -m0755 GZIP=gzip -9 GZIP_MAN=yes # ### No user-serviceable parts below. VERSION=0.2.1 DEFINES=-DVERSION='"$(VERSION)"' WARNFLAGS=-std=c89 -Wall -pedantic -Wextra CFLAGS=$(DEFINES) $(WARNFLAGS) $(MYCFLAGS) SRCS=uxd.c getopt.c usage.c .PHONY: all test man clean realclean install g++ clang++ clang cosmocc tcc pcc all: uxd man uxd: $(SRCS) $(CC) $(CFLAGS) $(LDFLAGS) -o uxd $(SRCS) $(LIBS) usage.c: uxd.rst mkusage.pl perl mkusage.pl uxd.rst > usage.c install: all mkdir -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(MAN1DIR) $(INSTALL_DATA) uxd.1 $(DESTDIR)$(MAN1DIR) [ "$(GZIP_MAN)" = "yes" ] && $(GZIP) $(DESTDIR)$(MAN1DIR)/uxd.1 || true $(INSTALL_PROGRAM) uxd $(DESTDIR)$(BINDIR) test: uxd ./uxd man: uxd.1 uxd.1: uxd.rst ver.rst $(RST2MAN) uxd.rst > uxd.1 ver.rst: echo '.. |version| replace:: $(VERSION)' > ver.rst clean: rm -f uxd *.o realclean: clean rm -f uxd.1 usage.c # the rest of the targets are for portability testing. cosmocc: clean $(MAKE) CC=cosmocc tcc: clean $(MAKE) CC=tcc pcc: clean $(MAKE) CC=pcc clang: clean $(MAKE) CC=clang g++: clean $(MAKE) CC=g++ WARNFLAGS="-Wall -Wno-write-strings -xc++" clang++: clean $(MAKE) CC=clang++ WARNFLAGS="-Wall -Wno-write-strings -xc++"