aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2025-11-17 03:59:20 -0500
committerB. Watson <urchlay@slackware.uk>2025-11-17 03:59:20 -0500
commita23b1790b87a75e38fd00f9d537669f44718023d (patch)
tree3f9c35fc6c439f14b66526dfa9d274344a017f64
parent1bdf2f116885f5597fda0c8741322fbd888ef55f (diff)
downloadunalf-a23b1790b87a75e38fd00f9d537669f44718023d.tar.gz
Add windows binary release target.
-rw-r--r--README_Windows.txt12
-rw-r--r--src/Makefile23
-rw-r--r--src/unalf.c7
3 files changed, 40 insertions, 2 deletions
diff --git a/README_Windows.txt b/README_Windows.txt
new file mode 100644
index 0000000..91c681a
--- /dev/null
+++ b/README_Windows.txt
@@ -0,0 +1,12 @@
+This is the Windows binary release of unalf @VERSION@.
+
+See README.txt, unalf.html, and alfsum.html for full documentation.
+
+The binaries (unalf.exe and alfsum.exe) were built with a cross gcc
+compiler on a Linux system. They should run on any recent 64-bit
+Windows OS. The author doesn't actually use Windows, so if you run
+into problems, please let me know.
+
+I can be reached by email at:
+
+urchlay@slackware.uk
diff --git a/src/Makefile b/src/Makefile
index a8788ab..4e37624 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -63,7 +63,7 @@ alfsum.1: alfsum.rst ver.rst
$(RST2MAN) alfsum.rst > alfsum.1
clean:
- rm -f *.o unalf alfsum ../f65/f65.o
+ rm -f *.o unalf alfsum ../f65/f65.o *.exe
install: all
mkdir -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(MAN1DIR) $(DESTDIR)$(DOCDIR)
@@ -74,3 +74,24 @@ install: all
$(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 *
+
diff --git a/src/unalf.c b/src/unalf.c
index 39685e7..6bfd94d 100644
--- a/src/unalf.c
+++ b/src/unalf.c
@@ -29,7 +29,12 @@ static void set_self(char *argv0) {
static void create_outdir(void) {
int r;
- r = mkdir(opts.outdir, 0777);
+ r =
+#if defined(__MINGW32__) || defined(__MINGW64__)
+ mkdir(opts.outdir);
+#else
+ mkdir(opts.outdir, 0777);
+#endif
if(r < 0 && errno != EEXIST) {
fprintf(stderr, "%s: ", self);
perror(opts.outdir);