# Makefile for unalf, by B. Watson. WTFPL. # Tested with GNU make. Does not work with BSD make, sorry. ### Override these variables as needed. Don't override CFLAGS; use # COPT instead. COPT=-O3 INSTALL=install 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 DOCDIR=$(PREFIX)/doc/unalf-$(VERSION) DESTDIR= INSTALL_DATA=$(INSTALL) -m0644 INSTALL_PROGRAM=$(INSTALL) -s -m0755 GZIP=gzip -9 GZIP_MAN=yes # ### No user-serviceable parts below. VERSION=0.1.0 CFLAGS=-DVERSION='"$(VERSION)"' -Wall -Wno-unused-label -I../f65 $(COPT) .PHONY: all clean install all: unalf unalf.1 alfsum alfsum.1 unalf: unalf.o io.o listalf.o extract.o ../f65/f65.o glob.o opts.o usage.o usage.o: usage.c usage.c: mkusage.pl unalf.rst perl mkusage.pl unalf.rst > usage.c unalf.o: unalf.c unalf.h ../f65/f65.h glob.o: glob.c unalf.h opts.o: opts.c unalf.h io.o: io.c unalf.h addrs.h ../f65/f65.h listalf.o: listalf.c addrs.h unalf.h ../f65/f65.h extract.o: extract.c addrs.h unalf.h ../f65/f65.h ../f65/f65.o: ../f65/f65.c ../f65/f65.h ver.rst: echo '.. |version| replace:: $(VERSION)' > ver.rst unalf.1: unalf.rst ver.rst $(RST2MAN) unalf.rst > unalf.1 alfsum.1: alfsum.rst ver.rst $(RST2MAN) alfsum.rst > alfsum.1 clean: rm -rf *.o unalf alfsum ../f65/f65.o *.exe wintmp \ unalf.html alfsum.html *.aarch64.elf *.com.dbg # these are generated files, but they *are* checked into git. realclean: clean rm -f unalf.1 alfsum.1 usage.c install: all mkdir -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(MAN1DIR) $(DESTDIR)$(DOCDIR) $(INSTALL_DATA) unalf.1 $(DESTDIR)$(MAN1DIR) $(INSTALL_DATA) alfsum.1 $(DESTDIR)$(MAN1DIR) [ "$(GZIP_MAN)" = "yes" ] && $(GZIP) $(DESTDIR)$(MAN1DIR)/unalf.1 || true [ "$(GZIP_MAN)" = "yes" ] && $(GZIP) $(DESTDIR)$(MAN1DIR)/alfsum.1 || true $(INSTALL_PROGRAM) unalf $(DESTDIR)$(BINDIR) $(INSTALL_PROGRAM) alfsum $(DESTDIR)$(BINDIR) cp -r ../doc/* ../examples $(DESTDIR)$(DOCDIR) crosswin: clean $(MAKE) CC=~/x-tools/x86_64-w64-mingw32/bin/x86_64-w64-mingw32-gcc html: alfsum.html unalf.html alfsum.html: alfsum.rst rst2html alfsum.rst > alfsum.html unalf.html: unalf.rst rst2html unalf.rst > unalf.html windows: crosswin html rm -rf wintmp unalf-$(VERSION)-win64.zip mkdir -p wintmp/{doc,examples} cp unalf.exe alfsum.exe wintmp cd .. ; for i in *.txt doc/*.txt doc/Arcinfo examples/*.txt; do sed 's,\n,\r\n,' $$i > src/wintmp/$$i; done cp ../examples/*.alf wintmp/examples cp alfsum.html unalf.html wintmp cd wintmp ; zip -r ../../unalf-$(VERSION)-win64.zip *