aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2025-11-20 17:20:44 -0500
committerB. Watson <urchlay@slackware.uk>2025-11-20 17:20:44 -0500
commit23f0ae0207876505774e27dbe1c06e6e51f8989a (patch)
treed101ccf02d16167f33494658e939ca11c72c6ca1
parentb49c71cd0b46ddeea22a3c1c69eb197023d8720b (diff)
downloadunalf-23f0ae0207876505774e27dbe1c06e6e51f8989a.tar.gz
Fix Makefile so it works with non-GNU makes.
-rw-r--r--BUILD.txt18
-rw-r--r--src/Makefile19
2 files changed, 24 insertions, 13 deletions
diff --git a/BUILD.txt b/BUILD.txt
index 2c43e39..ea26a0e 100644
--- a/BUILD.txt
+++ b/BUILD.txt
@@ -10,11 +10,13 @@ Build dependencies:
- rst2man. Only needed for regenerating the man pages.
+- make. This can be GNU, BSD, makepp, or probably any other standard-ish
+ make (anyone still using Solaris?).
+
Building:
If you're experienced at building software from source, src/Makefile
-should be self-explanatory. It requires GNU make, which might be
-"gmake" on your system.
+should be self-explanatory.
If you're not experienced, you can start by extracting the source:
@@ -22,18 +24,18 @@ If you're not experienced, you can start by extracting the source:
Next, compile the software:
- gmake
+ make
If you're on Slackware:
- sudo gmake install # or, as root, just 'gmake install'
+ sudo make install # or, as root, just 'make install'
This will install the binaries, man pages, and docs in locations
appropriate for Slackware Linux (since that's what the author uses).
If you're on a Debian or Ubuntu derivative, use:
- sudo gmake install MANDIR=/usr/share/man DOCDIR=/usr/share/doc/unalf
+ sudo make install MANDIR=/usr/share/man DOCDIR=/usr/share/doc/unalf
If you're on some other OS (Red Hat, *BSD, OSX, etc), ask someone
who actually uses that OS if you're not sure where things should be
@@ -41,13 +43,13 @@ installed to.
If you prefer /usr/local:
- sudo gmake install PREFIX=/usr/local MANDIR=/usr/local/share/man DOCDIR=/usr/local/share/doc/unalf
+ sudo make install PREFIX=/usr/local MANDIR=/usr/local/share/man DOCDIR=/usr/local/share/doc/unalf
Variables:
-You can set variables on the gmake command line. Example:
+You can set variables on the make command line. Example:
- gmake CC=clang COPT=-Os # use a different compiler, optimize for size
+ make CC=clang COPT=-Os # use a different compiler, optimize for size
See the top of src/Makefile for details on what variables exist and what
they're used for (not going to duplicate the list here).
diff --git a/src/Makefile b/src/Makefile
index 43ce094..58dba18 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -1,5 +1,5 @@
# Makefile for unalf, by B. Watson. WTFPL.
-# Tested with GNU make. Does not work with BSD make, sorry.
+# Tested with GNU make, BSD make, makepp, and Schily's dmake.
### Override these variables as needed. Don't override CFLAGS; use
# COPT instead.
@@ -39,16 +39,27 @@ VERSION=0.1.0
CFLAGS=-DVERSION='"$(VERSION)"' -Wall -I../f65 $(COPT)
+UNALF_OBJS=unalf.o io.o listalf.o extract.o f65.o glob.o opts.o usage.o self.o
+ALFSUM_OBJS=alfsum.o self.o
+
.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 self.o
+# unalf and alfsum need explicit rules for BSD make compatibility.
+# without them, bmake tries to run "cc -o unalf unalf.c" which ain't
+# gonna ever work.
+unalf: $(UNALF_OBJS)
+ $(CC) $(LDFLAGS) -o $@ $(UNALF_OBJS)
alfsum: alfsum.o self.o
+ $(CC) $(LDFLAGS) -o $@ $(ALFSUM_OBJS)
usage.o: usage.c
+f65.o: ../f65/f65.c ../f65/f65.h
+ $(CC) $(CFLAGS) -c -o f65.o ../f65/f65.c
+
usage.c: mkusage.pl unalf.rst
perl mkusage.pl unalf.rst > usage.c
@@ -64,8 +75,6 @@ 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
@@ -76,7 +85,7 @@ alfsum.1: alfsum.rst ver.rst manftr.rst
$(RST2MAN) alfsum.rst > alfsum.1
clean:
- rm -rf *.o unalf alfsum ../f65/f65.o *.exe wintmp \
+ rm -rf *.o unalf alfsum *.exe wintmp \
unalf.html alfsum.html *.aarch64.elf *.com.dbg
# these are generated files, but they *are* checked into git.