Add a man page.
[sgt/halibut] / Makefile
CommitLineData
d7482997 1# Halibut master makefile
2
3# Requires a compiler with -MD support, currently
4
5# `make' from top level will build in directory `build'
6# `make BUILDDIR=foo' from top level will build in directory foo
7ifndef REALBUILD
8ifndef BUILDDIR
9ifdef TEST
10BUILDDIR := test
11else
12BUILDDIR := build
13endif
14endif
15all:
16 @test -d $(BUILDDIR) || mkdir $(BUILDDIR)
17 @make -C $(BUILDDIR) -f ../Makefile REALBUILD=yes
48f8f266 18spotless: topclean
d7482997 19 @test -d $(BUILDDIR) || mkdir $(BUILDDIR)
20 @make -C $(BUILDDIR) -f ../Makefile spotless REALBUILD=yes
48f8f266 21clean: topclean
d7482997 22 @test -d $(BUILDDIR) || mkdir $(BUILDDIR)
23 @make -C $(BUILDDIR) -f ../Makefile clean REALBUILD=yes
48f8f266 24topclean:
25 # Remove Halibut output files in the source directory (may
26 # have been created by running, for example, `build/halibut
27 # inputs/test.but').
28 rm -f *.html output.*
d7482997 29else
30
31# The `real' makefile part.
32
33CFLAGS += -Wall -W
34
35ifdef TEST
36CFLAGS += -DLOGALLOC
37LIBS += -lefence
38endif
39
40ifdef RELEASE
41ifndef VERSION
42VERSION := $(RELEASE)
43endif
44else
45CFLAGS += -g
46endif
47
48ifndef VER
49ifdef VERSION
50VER := $(VERSION)
51endif
52endif
53ifdef VER
54VDEF := -DVERSION=\"$(VER)\"
55endif
56
57SRC := ../
58
59MODULES := main malloc ustring error help licence version misc tree234
60MODULES += input keywords contents index style biblio
7136a6c7 61MODULES += bk_text bk_xhtml bk_whlp bk_man
d7482997 62MODULES += winhelp
63
64OBJECTS := $(addsuffix .o,$(MODULES))
65DEPS := $(addsuffix .d,$(MODULES))
66
67halibut: $(OBJECTS)
68 $(CC) $(LFLAGS) -o halibut $(OBJECTS) $(LIBS)
69
70%.o: $(SRC)%.c
71 $(CC) $(CFLAGS) -MD -c $<
72
73version.o: FORCE
74 $(CC) $(VDEF) -MD -c $(SRC)version.c
75
76spotless:: clean
77 rm -f *.d
78
79clean::
80 rm -f *.o halibut core
81
82FORCE: # phony target to force version.o to be rebuilt every time
83
84-include $(DEPS)
85
86endif