cfe4810effc5ae620172b55d5ed9147d803a44b9
[citadel.git] / citadel / techdoc / build.txt
1  Oct 28 01:57 1998 from LoanShark @uncnsrd 
2 what i've done with the Makefile.in most recently is to replace all the 
3 rules that explicitly generated .o files with a set of suffix rules. these 
4 are the `.c.o:', `.c.mo:', and `.c.ro:' targets that appear in the 
5 Makefile.in. the idea is, make now knows how to generate files named 
6 `foo.o', `foo.mo', or `foo.ro' from a file `foo.c'. a .o file is compiled 
7 with standard compiler flags; a .ro (reentrant object) file is also 
8 compiled with -D_REENTRANT; and a .mo (module object) is compiled with 
9 -D_REENTRANT plus -fPIC and -DPIC to produce position-independent code for 
10 a shared library. the suffix rules, together with auto dependency 
11 generation, accomplish two things: when you want to link a particular 
12 module into a binary, all you have to do is list it, with the appropriate 
13 extension, as a dependency of the binary, and add it to the link command 
14 line for the target. you don't have to worry about writing a rule to 
15 generate the object with the proper flags, or keep the header file 
16 dependencies updated. secondly, using different file extensions allows us 
17 to compile _REENTRANT and non-REENTRANT versions of files like config.c, 
18 tools.c, and snprintf.c that are used in both the clients and the server. 
19
20   autodependency generation is implemented by generating a bunch of .d  
21 files (with another suffix rule) using $(CC) - M and "-include"-ing them 
22 from the main Makefile. the .d files are made to depend on the .c files 
23 they correspond to, and the referenced header files, so they're updated as 
24 needed. the only version of make that I know for sure works with this is 
25 GNU make, but the Makefile should still work on other versions of Unix 
26 make, just without the autodependency stuff. 
27
28
29  Oct 28 20:49 1998 from LoanShark @uncnsrd 
30 one thing I forgot to mention about the autodependency generation: for a 
31 file to be included in the autodepend process, it must be listed in the 
32 SOURCES macro near the top of Makefile.in. 
33   also, I've added an 'install' target to the makefile. this will make it  
34 possible to build RPM's, and bring the installation process closer to that 
35 of other packages, which if you're using the new configure script goes 
36 like this: 
37   ./configure [--enable-ansi-color] [--disable-auto-login] [--prefix=/foo] 
38  
39   
40   --prefix specifies the location the BBS will run from,  
41 /usr/local/citadel by default. 
42   to build a highly optimized version without debugging symbols, you could 
43  do something like this (with the bourne shell): 
44   CC=egcs CFLAGS='-O6 -fomit-frame-pointer' ./configure   
45   after configuring, simply type `make', then su to a user who has  
46 appropriate permissions, and `make install'. then run setup as usual. 
47   are there any other areas that need to be cleared up? 
48