]>
Commit | Line | Data |
---|---|---|
d1b2a10e | 1 | /**/# |
2 | /**/# The Main rules | |
3 | /**/# | |
4 | ||
5 | /* | |
6 | * This is the standard rule for compiling system calls | |
7 | */ | |
8 | #define library_sysobj_rule() @@\ | |
9 | .c.o: @@\ | |
10 | $(CPP) -E -DPROF $*.c | $(AS) -o $*.o -Mx @@\ | |
11 | -$(LD) -X -r -o profiled/$*.o $*.o @@\ | |
12 | $(CPP) -E $*.c | $(AS) -o $*.o -Mx @@\ | |
13 | -$(LD) -x -r -o a.out $*.o @@\ | |
14 | mv a.out $*.o | |
15 | ||
16 | ||
17 | /* | |
18 | * ... and for other objects in libraries | |
19 | */ | |
20 | #define library_obj_rule() @@\ | |
21 | .s.o: @@\ | |
22 | $(CPP) $(DEFINES) -E -DPROF $*.s \ @@\ | |
23 | | $(AS) $(AFLAGS) -68020 -o $*.o -Mx @@\ | |
24 | -$(LD) -X -r -o profiled/$*.o $*.o @@\ | |
25 | $(CPP) $(DEFINES) -E $*.s | $(AS) $(AFLAGS) -68020 -o $*.o -Mx @@\ | |
26 | -$(LD) -x -r -o a.out $*.o @@\ | |
27 | mv a.out $*.o @@\ | |
28 | @@\ | |
29 | .c.o: @@\ | |
30 | $(CC) -p -c $(CFLAGS) $*.c @@\ | |
31 | -$(LD) -X -r -o profiled/$*.o $*.o @@\ | |
32 | $(CC) -c $(CFLAGS) $*.c @@\ | |
33 | -$(LD) -x -r -o a.out $*.o @@\ | |
34 | mv a.out $*.o | |
35 | ||
36 | ||
37 | /* | |
38 | * These two are used by things like csh... | |
39 | */ | |
40 | #define cxstr_obj_target(target) @@\ | |
41 | target.o: target @@\ | |
42 | ${XSTR} @@\ | |
43 | ${CC} -c -R xs.c @@\ | |
44 | mv -f xs.o target.o @@\ | |
45 | rm -f xs.c | |
46 | ||
47 | #define cxstr_obj_rule() @@\ | |
48 | .c.o: @@\ | |
49 | ${CC} -E ${CFLAGS} $*.c | ${XSTR} -c - @@\ | |
50 | ${CC} -c ${CFLAGS} x.c @@\ | |
51 | mv -f x.o $*.o @@\ | |
52 | rm -f x.c | |
53 | ||
54 | ||
55 | /* | |
56 | * Special library rules for generating files from the UTek library | |
57 | */ | |
58 | #define tools_library_obj_rule() @@\ | |
59 | .s.o: @@\ | |
60 | $(CPP) $(DEFINES) -E $*.s | $(AS) $(AFLAGS) -68020 -o $*.o -Mx @@\ | |
61 | -$(LD) -x -r -o a.out $*.o @@\ | |
62 | mv a.out $*.o @@\ | |
63 | @@\ | |
64 | .c.o: @@\ | |
65 | $(CC) -c $(CFLAGS) $*.c @@\ | |
66 | -$(LD) -x -r -o a.out $*.o @@\ | |
67 | mv a.out $*.o | |
68 | ||
69 | #define library_target(libname) @@\ | |
70 | all: lib/**/libname lib/**/libname/**/_p @@\ | |
71 | lib/**/libname: $(OBJS) @@\ | |
72 | ar cruf $@ $(OBJS) @@\ | |
73 | lib/**/libname/**/_p: $(OBJS) @@\ | |
74 | cd profiled; ar cruf ../$@ $(OBJS) | |
75 | ||
76 | #define tools_library_target(libname) @@\ | |
77 | all: lib/**/libname @@\ | |
78 | lib/**/libname: $(OBJS) @@\ | |
79 | ar cru $@ $(OBJS) @@\ | |
80 | ||
81 | /* | |
82 | * Note that '/*' plays havoc with cpp. So we use the equivalent '/?*'. | |
83 | */ | |
84 | #define multiple_library_target(libname,dirlist) @@\ | |
85 | all: lib/**/libname lib/**/libname/**/_p @@\ | |
86 | @@\ | |
87 | lib/**/libname: dirlist @@\ | |
88 | -mkdir tmp @@\ | |
89 | for i in dirlist; do \ @@\ | |
90 | (cd tmp; ar x ../$$i/lib$${i}); done @@\ | |
91 | ar crf $@ `ls tmp/?*.o` @@\ | |
92 | rm -rf tmp @@\ | |
93 | lib/**/libname/**/_p: dirlist @@\ | |
94 | -mkdir tmp @@\ | |
95 | for i in dirlist; do \ @@\ | |
96 | (cd tmp; ar x ../$$i/lib$${i}_p); done @@\ | |
97 | ar crf $@ `ls tmp/?*.o` @@\ | |
98 | rm -rf tmp @@\ | |
99 | @@\ | |
100 | dirlist: FRC @@\ | |
101 | cd $@; $(IMAKE) $(MFLAGS) all @@\ | |
102 | FRC: | |
103 | ||
104 | ||
105 | /* | |
106 | * This is a basic program target | |
107 | */ | |
108 | #define program_target(program, objlist) @@\ | |
109 | program: objlist $(SYSOBJECTS) @@\ | |
110 | $(CC) -o $@ objlist $(LDFLAGS) @@\ | |
111 | $(XINU) $@ | |
112 | ||
113 | ||
114 | /* | |
115 | * This target can be called by all programs that are contained in | |
116 | * a single c source file. | |
117 | */ | |
118 | #define simple_program_target(program,dest) @@\ | |
119 | OBJS = program.$O @@\ | |
120 | SRCS = program.c @@\ | |
121 | @@\ | |
122 | complex_program_target(program,dest) | |
123 | ||
124 | ||
125 | /* | |
126 | * This target is like simple_program_target() except that the dependency | |
127 | * list is long (it must be provided in the Imakefile. | |
128 | */ | |
129 | #define complex_program_target(program,dest) @@\ | |
130 | program: $(OBJS) $(SYSOBJECTS) @@\ | |
131 | $(CC) -o $@ $(OBJS) $(LDFLAGS) @@\ | |
132 | $(XINU) $@ @@\ | |
133 | @@\ | |
134 | install_program(program,dest) @@\ | |
135 | depend_target() | |
136 | ||
137 | ||
138 | /* | |
139 | * Compile an assembler module that is kept in a .c file (like the | |
140 | * system call library). | |
141 | */ | |
142 | #define casm_obj_target(basename) @@\ | |
143 | basename.$O: basename.c @@\ | |
144 | ${CC} -E basename.c | ${AS} -o basename.$O | |
145 | ||
146 | /* | |
147 | * Install a non-executable file. | |
148 | */ | |
149 | #define install_non_exec(file,dest) @@\ | |
150 | install:: file @@\ | |
151 | install68 -c -m 0664 file $(DEST)/dest | |
152 | ||
153 | ||
154 | /* | |
155 | * Install a shell program. Must be named 'program'.sh. | |
156 | */ | |
157 | #define install_shell(program,dest) @@\ | |
158 | install:: program.sh @@\ | |
159 | install68 -c program.sh $(DEST)/dest/program | |
160 | ||
161 | #define install_program(program,dest) @@\ | |
162 | install:: program @@\ | |
163 | install68 -c program $(DEST)/dest | |
164 | ||
165 | #define install_multiple(list,dest) @@\ | |
166 | install:: list @@\ | |
167 | @for i in list; do \ @@\ | |
168 | (set -x; install68 -c $$i $(DEST)/dest); \ @@\ | |
169 | done | |
170 | ||
171 | #define install_library(libname,dest) @@\ | |
172 | install:: lib/**/libname lib/**/libname/**/_p @@\ | |
173 | install68 -c -r -x lib/**/libname \ @@\ | |
174 | $(DEST)/dest/lib/**/libname.a @@\ | |
175 | install68 -c -r -x lib/**/libname/**/_p \ @@\ | |
176 | $(DEST)/dest/lib/**/libname/**/_p.a @@\ | |
177 | @@\ | |
178 | install_vax_library(libname,lib68) | |
179 | ||
180 | #define install_vax_library(libname,dest) @@\ | |
181 | install:: lib/**/libname lib/**/libname/**/_p @@\ | |
182 | install68 -c -r lib/**/libname \ @@\ | |
183 | $(TOOLSDEST)/dest/lib/**/libname.a @@\ | |
184 | install68 -c -r lib/**/libname/**/_p \ @@\ | |
185 | $(TOOLSDEST)/dest/lib/**/libname/**/_p.a @@\ | |
186 | ||
187 | #define install_tools_library(libname,dest) @@\ | |
188 | install:: lib/**/libname @@\ | |
189 | install68 -c -r lib/**/libname \ @@\ | |
190 | $(DEST)/dest/lib/**/libname.a @@\ | |
191 | ||
192 | /* | |
193 | * Do an imake on multiple sub-directories. | |
194 | */ | |
195 | #define imake_multiple() @@\ | |
196 | all: @@\ | |
197 | @-for dir in `ls -F | egrep /`; do \ @@\ | |
198 | (set -x; cd $$dir; $(IMAKE)); \ @@\ | |
199 | done @@\ | |
200 | @@\ | |
201 | imake_multiple_install() | |
202 | ||
203 | ||
204 | #define imake_multiple_install() @@\ | |
205 | install:: @@\ | |
206 | @-for dir in `ls -F | egrep /`; do \ @@\ | |
207 | (set -x; cd $$dir; $(IMAKE) install); \ @@\ | |
208 | done | |
209 | ||
210 | /* | |
211 | * This makes the depend target given OBJS. | |
212 | */ | |
213 | #define DependComment '# define Dependencies for $(MACHINE)' | |
214 | #define depend_target() @@\ | |
215 | depend: @@\ | |
216 | echo DependComment > $(MACHINE).depend @@\ | |
217 | makedepend -s DependComment \ @@\ | |
218 | -f $(MACHINE).depend \ @@\ | |
219 | $(DEPEND_INCLUDES) \ @@\ | |
220 | $(DEPEND_DEFINES) \ @@\ | |
221 | $(INCLUDES) \ @@\ | |
222 | $(SRCS) |