Added options to make Robodoc more customizable.
[robodoc.git] / Source / makefile.plain
1 # -*-makefile-*-
2 # vi: ff=unix
3 #
4 #****h* ROBODoc/Makefile.plain
5 # NAME
6 #   Makefile.plain -- Plain makefile that does not need autoconf 
7 # SYNOPSIS
8 #   * make -f makefile.plain robodoc
9 #   * make -f makefile.plain html
10 #   * make -f makefile.plain count
11 #   * make -f makefile.plain test
12 #   * make -f makefile.plain clean
13 #   * make -f makefile.plain xcompile
14 #
15 # PURPOSE
16 #   The makefile GCC.
17 #   You can use it if you are on a non Unix system or a system
18 #   that does not support autoconfiguration.
19 #
20 #   The following targets are the most useful for the user:
21 #   * robodoc -  makes the robodc executable.
22 #   * example -  makes robodoc and shows you the autodocs
23 #                generated from the ROBODoc source code
24 #                using browser.
25 #   * html    -  makes autodocs for robodoc in html format.
26 #
27 #   To build robodoc use:
28 #   * make -f makefile.plain robodoc
29 #
30 #   Developers might try:
31 #   * depend  - create dependencies
32 #   * test    -
33 #   * count   -
34 #   * clean   -
35 #
36 # NOTES
37 #   This documentation is not complete. It is just a test to see
38 #   how to best use ROBODoc with makefiles.
39 #
40 #****
41 #
42 # $Id: makefile.plain,v 1.63 2007/07/10 19:13:52 gumpu Exp $
43 #
44
45 SHELL = /bin/sh
46 .SUFFIXES:
47 .SUFFIXES: .c .o
48
49 #--------------------------------------
50 # use gcc (generic)
51 #--------------------------------------
52
53 CC = gcc
54 # CFLAGS = -g -Wall -Wshadow -Wbad-function-cast -Wconversion -Wredundant-decls 
55 # -Wunreachable-code
56 # TODO try to get this to compile with -Wconversion
57
58 CFLAGS = -g -Wall -Wshadow -Wbad-function-cast -Wredundant-decls
59 LIBS=
60
61 #
62
63 BROWSER=netscape
64 ROBODOC=./robodoc
65 ETAGS=/usr/bin/etags
66 EGREP=/bin/egrep
67 RM=/bin/rm
68 MINGW_CC=/usr/bin/i586-mingw32msvc-gcc
69 VERS=4.99.36
70 RELEASE=1
71 all: robodoc robohdrs
72
73 #--------------------------------------
74 # sources for the robodoc executable
75 #--------------------------------------
76
77 SOURCES = \
78           analyser.c \
79           ascii_generator.c \
80           directory.c \
81           generator.c \
82           document.c \
83           globals.c \
84           headers.c \
85           headertypes.c \
86           html_generator.c \
87           items.c \
88           links.c \
89           file.c \
90           latex_generator.c \
91           optioncheck.c \
92           part.c \
93           path.c \
94           roboconfig.c \
95           robodoc.c \
96           rtf_generator.c \
97           test_generator.c \
98           troff_generator.c \
99           util.c \
100           xmldocbook_generator.c
101
102 HEADERS= \
103          analyser.h \
104          ascii_generator.h \
105          directory.h \
106          dirwalk.h \
107          document.h \
108          file.h \
109          generator.h \
110          globals.h \
111          headers.h \
112          headertypes.h \
113          html_generator.h \
114          items.h \
115          latex_generator.h \
116          links.h \
117          optioncheck.h \
118          part.h \
119          path.h \
120          roboconfig.h \
121          robodoc.h \
122          rtf_generator.h \
123          test_generator.h \
124          troff_generator.h \
125          unittest.h \
126          util.h \
127          xmldocbook_generator.h
128
129 OBJECTS = $(SOURCES:.c=.o)
130 DEPENDS = $(OBJECTS:.o=.d)
131
132 #****e* Makefile.plain/robodoc
133 # NAME
134 #   robodoc --
135 # NOTE
136 #   This assumes that you version of make knows how to make an .o file
137 #   out of an .c file.
138 # SOURCE
139 #
140
141 robodoc : $(OBJECTS) 
142         $(CC) $(OBJECTS) -o robodoc$(EXE) $(LIBS)
143
144 #****
145
146 #****e* Makefile.plain/robohdrs
147 # NAME
148 #   robohdrs --
149 # SOURCE
150 #
151
152 robohdrs : robodoc robohdrs.o headers.o
153         $(CC) $(CFLAGS) util.o globals.o robohdrs.o headers.o roboconfig.o headertypes.o -o robohdrs$(EXE)
154
155 #****
156
157 html : robodoc.html
158
159 robodoc.html : robodoc
160         ./robodoc --src ./ --doc robodoc --singledoc --html --sections --toc
161
162 #****e* Makefile.plain/example
163 # NAME
164 #   example -- create and show autodocs extracted from ROBODoc source.
165 # FUNCTION
166 #
167 #****
168
169 example : html 
170         $(BROWSER) robodoc.html
171
172 #----------------------------
173 # Development
174 #----------------------------
175
176 tags :
177         $(ETAGS) *.c *.h
178
179 #****e* Makefile.plain/count
180 # NAME
181 #   count -- count the number of lines of the ROBODoc source.
182 #****
183
184 count :
185         $(EGREP) -v -G "^ \*" *.c *.h | egrep -v -G "/\*"  | wc
186
187
188 #****e* Makefile.plain/test
189 # NAME
190 #   test -- run some tests
191 # FUNCTION
192 #   Runs robodoc on file with a number of different headers.
193 # HISTORY
194 #   2002-05-19/PetteriK: test cases in Test directory run with this rule
195 #
196 #****
197
198 test : $(ROBODOC)
199         (cd Test; $(MAKE))
200
201 #****e* Makefile.plain/clean
202 # NAME
203 #   clean -- Clean up the mess we made.
204 # FUNCTION
205 #   Cleans up the mess we made.
206 #*****
207
208 clean :
209         $(RM) -f $(DOCS) $(XREF)
210         $(RM) -f robodoc robohdrs
211         $(RM) -f *~
212         $(RM) -f *.o *.tex *.toc *.dvi *.aux *.log *.ps *.exe
213         $(RM) -f robodoc.html
214         $(RM) -f testheaders.html
215         $(RM) -f stamp-h* makefile.in config.h
216
217 #****e* Makefile.plain/xcompiler-test
218 # NAME
219 #   xcompiler-test
220 # SYNOPSIS
221 #   make -f makefile.plain xcompiler-test
222 # NOTE
223 #   Used by do.sh.  
224 # RESULT
225 #   Exit status 0 if cross-compiler is found.
226 # SOURCE
227 #
228
229 xcompiler-test:
230         test -x $(MINGW_CC)
231         zip -h > /dev/null 2>&1
232
233 #*****
234
235 #****e* Makefile.plain/xcompile
236 # NAME
237 #   xcompile
238 # SYNOPSIS
239 #   make -f makefile.plain xcompile
240 #   make -f makefile.plain MINGW_CC=/path/to/mingwcc xcompile
241 # NOTE
242 #   Cross-compile Wintel binary.
243 #   Consider `apt-get install mingw32' before running this.
244 # RESULT
245 #   Excutable `robodoc.exe' is created.
246 # SOURCE
247 #
248
249 xcompile:
250         $(MAKE) -f makefile.plain CC=$(MINGW_CC) EXE=.exe robodoc
251
252 #***** end xcompile
253
254 #------------------------------
255 # Construction of the makefile
256 #------------------------------
257
258 -include $(DEPENDS)
259
260 depend:
261         $(CC) -MMD -E $(SOURCES) > /dev/null
262