Rewrite Makefile

Sweeping changes; the old Makefile was rudimentary and buggy.

NB: makedepend is optional. You don't need to run it.
This commit is contained in:
Lassi Kortela 2023-02-15 14:31:59 +02:00
parent 00a2baa9ca
commit 0d0d0afbfd
1 changed files with 38 additions and 41 deletions

View File

@ -1,39 +1,26 @@
# $Revision: 1.12 $ PREFIX = $$HOME/.local
BINDIR = $(PREFIX)/bin
DATADIR = $(PREFIX)/share
### You need a C compiler that compiles ANSI C code. ELK_INCLUDE_DIR = $(PREFIX)/include
CC = gcc ELK_LIB_DIR = $(PREFIX)/lib
CFLAGS = -Wall -pedantic -O
### If you need additional linker flags add them here. CTAGS = ctags -t -w
LDFLAGS = INSTALL = install
MAKEDEPEND = makedepend
### The directory where the Elk installation resides on your system. CC = gcc
ELKDIR = /usr/elk CFLAGS = -Wall -pedantic -O -I $(ELK_INCLUDE_DIR)
LDFLAGS = -L $(ELK_LIB_DIR) -lm -lelk
### Additional libraries. You may want to insert the output of the
### shell-script $(ELKDIR)/lib/ldflags here.
LIBS = -lm
### The makedepend program (it's usually installed with the X11 binaries).
MAKEDEP = makedepend
### The directory under which you will install the Scheme files. ### The directory under which you will install the Scheme files.
DIR = /usr/local/lib/unroff DEFAULT_DIR = $(DATADIR)/unroff
SCMDIR = $(DATADIR)/unroff/scm
### The default output format. DEFAULT_FORMAT = html
FORMAT = html
INCLUDE = -I $(ELK_INCLUDE_DIR)
DEFS = -D DEFAULT_DIR=\"$(DEFAULT_DIR)\" -D DEFAULT_FORMAT=\"$(DEFAULT_FORMAT)\"
### End of configurable variables.
### -------------------------------------------------------------------------
SHELL = /bin/sh
INCLUDE = -I$(ELKDIR)/include
ELK = $(ELKDIR)/lib/module.o
DEFS = -DDEFAULT_DIR=\"$(DIR)\" -DDEFAULT_FORMAT=\"$(FORMAT)\"
CTAGS = ctags -t -w
SOURCES = \ SOURCES = \
args.c\ args.c\
@ -67,27 +54,37 @@ OBJECTS = \
stream.o\ stream.o\
subst.o\ subst.o\
table.o\ table.o\
unroff.o\ unroff.o
$(ELK)
ALL = unroff all: unroff
all: $(ALL) unroff: $(OBJECTS)
$(CC) $(LDFLAGS) -o $@ $(OBJECTS)
.c.o: .c.o:
$(CC) $(CFLAGS) $(INCLUDE) $(DEFS) -c $< $(CC) $(CFLAGS) $(INCLUDE) $(DEFS) -c $<
clean: install: unroff
rm -f *.o $(ALL) $(INSTALL) unroff $(BINDIR)/unroff
mkdir -p $(SCMDIR)
mkdir -p $(SCMDIR)/html
mkdir -p $(SCMDIR)/misc
$(INSTALL) -m 644 ../scm/html/common.scm $(SCMDIR)/html/common.scm
$(INSTALL) -m 644 ../scm/html/m.scm $(SCMDIR)/html/m.scm
$(INSTALL) -m 644 ../scm/html/man.scm $(SCMDIR)/html/man.scm
$(INSTALL) -m 644 ../scm/html/ms.scm $(SCMDIR)/html/ms.scm
$(INSTALL) -m 644 ../scm/misc/hyper.scm $(SCMDIR)/misc/hyper.scm
$(INSTALL) -m 644 ../scm/troff.scm $(SCMDIR)/troff.scm
tags ctags: $(SOURCES) clean:
rm -f $(OBJECTS) unroff
tags ctags: $(SOURCES)
$(CTAGS) $(SOURCES) $(CTAGS) $(SOURCES)
unroff: $(OBJECTS) depend: Makefile $(SOURCES)
$(CC) $(LDFLAGS) -o $@ $(OBJECTS) $(LIBS) $(MAKEDEPEND) $(INCLUDE) $(SOURCES)
depend: Makefile $(SOURCES)
$(MAKEDEP) $(INCLUDE) $(SOURCES)
.PHONY: all clean ctags depend install tags
# DO NOT DELETE THIS LINE -- make depend depends on it. # DO NOT DELETE THIS LINE -- make depend depends on it.