source: gpfs_3.1_ker2.6.20/lpp/mmfs/src/config/imake.tmpl @ 90

Last change on this file since 90 was 16, checked in by rock, 17 years ago
File size: 28.3 KB
Line 
1#define XCOMM #
2#define _POUND_ #
3_POUND_ $Id: imake.tmpl,v 1.113.2.2 2006/10/06 22:33:17 yuri Exp $
4_POUND_==================================================
5_POUND_ Copyright IBM 1993
6_POUND_==================================================
7
8_POUND_##################################################
9_POUND_ This makefile is automatically generated by
10_POUND_ imake... do not modify or you may lose your
11_POUND_ changes when imake generates makefiles again.
12_POUND_ Ignore this message if you are not using imake.
13_POUND_##################################################
14
15/* On Linux, the imake that comes with X11 defines "linux" to be "1".
16   This causes problems because the word "linux" appears in several
17   directory names (e.g., /usr/include/linux, ts/kernext/gpl-linux).
18   If "linux" is defined, undefine it and define "LINUX_IMAKE" instead. */
19#ifdef linux
20#undef linux
21#define LINUX_IMAKE 1
22#endif
23
24RESOLVLIB =
25
26DESTDIR = $(SHARKCLONEROOT)
27TOOLDIR = /local/bin
28SHELL = /bin/sh
29CSHELL = /bin/csh
30
31#ifdef LINUX_IMAKE
32IMAKE = /usr/X11R6/bin/imake
33CC=g++
34C_COMP=gcc
35/* CC = egcs */
36/* C_COMP = egcs */
37INSTALL = /usr/bin/install
38AR = ar clq
39BARELD = ld
40KAR = ld $(LDFLAGS2) -r -o
41ARDEL = ar d
42MAKEDEPEND = g++
43CPLUSINC =
44#else /* LINUX_IMAKE */
45IMAKE = $(TOOLDIR)/imake
46CC = xlC_r
47C_COMP = cc_r
48INSTALL = /usr/ucb/install
49AR = ar -clq
50KAR = $(AR)
51ARDEL = ar -d
52MAKEDEPEND = xlC_r
53CPLUSINC = -I/usr/lpp/xlC/include
54#endif
55
56LD = $(CC)
57CDEBUGFLAGS =
58
59NATIVE_CC=$(CC)
60NATIVE_C_COMP=$(C_COMP)
61NATIVE_LD=$(NATIVE_CC)
62
63/* Default flags for supplemental patches that must be applied to select
64   portions of the code, which are not part of the standard kernel patching.
65   These flags can be modified in individual Imakefiles if multiple
66   supplemental patches are required (by setting flags *before* ObjectRule). */
67PATCHED_KERNEL_FLAGS =
68
69/* Default location for cxi header files */
70CXI_HEADER_DIR = $(DESTDIR)/include
71#ifdef LINUX_IMAKE
72/* For Linux we want cxi headers separated from proprietary headers */
73CXI_HEADER_DIR = $(DESTDIR)/include/cxi
74#endif /* LINUX_IMAKE */
75
76SOURCE_CONTROL = cvs
77SRC_UPDATE_CMD = $(SOURCE_CONTROL) update -d
78SRC_CHECKIN_CMD = $(SOURCE_CONTROL) ci -a
79
80DEPENDSCRIPT = $(DESTDIR)/bin/depend.sh
81PATCHSCRIPT = $(DESTDIR)/bin/applypatch.sh
82IMAKE_DEFINES =
83
84
85IRULESRC = $(DESTDIR)/shark/config
86
87NIDLFLAGS = -exts C.c,S.c,W.c
88NIDLINCLUDES = $(LOCALNIDLINCLUDES)
89
90LINTOPTS = -axz
91LINTLIBFLAG = -C
92
93#ifdef LINUX_IMAKE
94STD_CFLAGS =
95STD_LDFLAGS =
96STD_INCLUDES = -I$(DESTDIR)/include -I$(CXI_HEADER_DIR)
97ARFLAGS =
98KARFLAGS =
99STD_LDFLAGS = $(EXTRASTD_LDFLAGS)
100LDFLAGS2 = $(EXTRALDFLAGS2)
101#else
102STD_CFLAGS = -qtbtable=full -qinfo=gen:ret:uni:ini $(EXTRASTD_CFLAGS)
103STD_LDFLAGS = -qtwolink $(EXTRASTD_LDFLAGS)
104STD_INCLUDES = -I$(DESTDIR)/include -I$(CXI_HEADER_DIR)
105LDFLAGS2 = $(EXTRALDFLAGS2)
106ARFLAGS = $(EXTRAARFLAGS)
107KARFLAGS = $(EXTRAARFLAGS)
108M4FLAGS = $(EXTRAM4FLAGS)
109ASFLAGS = $(EXTRAASFLAGS)
110CFLAGS32 = -q32
111CFLAGS64 = -q64 -qlargetype
112#endif
113STD_KINCLUDES = $(STD_INCLUDES)
114
115AS = as
116CPP = /lib/cpp
117LINT = lint
118RM = rm -f
119MV = mv
120CP = cp
121LN = ln -s
122RANLIB = ranlib
123RPM = rpm
124RPMBUILD = /usr/bin/rpmbuild
125
126LS = ls
127AWK = awk
128SORT = sort
129TR = tr
130MAKE = /usr/bin/make
131MAKEDASH = -
132/* Override above to empty for gnumake */
133SED = sed
134LEX = lex
135YACC = yacc
136BISON = bison
137NIDL = /etc/ncs/nidl $(NIDLFLAGS)
138
139MKTRACE  = $(DESTDIR)/bin/mktrace
140MERGETRC = $(DESTDIR)/bin/mergetrc
141MKTRCFMT = $(DESTDIR)/bin/mktrcfmt
142MKRPC = $(DESTDIR)/bin/mkrpc
143CHKSYSTYPES = $(SHARKCLONEROOT)/../tools/chksystypes
144
145_POUND_ Ship values
146
147LPP_NAME=mmfs
148LOCAL_PROD_NAME = mmfs
149SHIP_TYPE = FILE
150SHIP_OWNER = bin
151SHIP_GROUP = system
152SHIP_CLASS = apply
153SHIP_ROOT = $(SHARKCLONEROOT)/ship
154SHIPDIR = $(SHIP_ROOT)/usr/lpp/$(LPP_NAME)
155SHIP_CMD = /usr/ucb/install -c
156
157_POUND_##################################################
158_POUND_ The following comes from the site.mcr
159_POUND_##################################################
160#include <site.mcr>
161_POUND_##################################################
162_POUND_ Back from site.mcr
163_POUND_##################################################
164
165.SUFFIXES: .o .32o .64o .C .c .s .spp .y .l .idl .sh .ko .spec .po .pko .rpc
166ALL_INCLUDES = -I. $(IMAKE_INCLUDES) $(STD_INCLUDES)
167ALL_KINCLUDES = -I. $(IMAKE_INCLUDES) $(STD_KINCLUDES)
168ALL_LIBPATHS = -L. $(IMAKE_LIBS)
169IMAKE_CMD = $(IMAKE) -Timake.tmpl -I. -I$(IRULESRC) -s makefile
170DOTDOTIMAKE_CMD = $(IMAKE) -Timake.tmpl -I. -I$(IRULESRC) -s makefile
171
172ALL_DEFINES = $(IMAKE_DEFINES) $(SITE_DEFINES) $(SITE_FAR_TRACE_OPTS) $(IMAKE_DEFINES_LAST)
173ALL_KDEFINES = $(IMAKE_DEFINES) $(SITE_DEFINES) $(SITE_OTHER_KDEFINES) $(SITE_KFAR_TRACE_OPTS)
174CFLAGS = $(OPTFLAGS) $(STD_CFLAGS) $(IMAKE_CFLAGS) $(CDEBUGFLAGS) $(ALL_INCLUDES) $(ALL_DEFINES)
175NATIVECFLAGS = -O $(STD_CFLAGS) $(IMAKE_CFLAGS) $(CDEBUGFLAGS) $(ALL_INCLUDES) $(ALL_DEFINES)
176KCFLAGS = $(KOPTFLAGS) $(STD_CFLAGS) $(IMAKE_CFLAGS) $(CDEBUGFLAGS) $(ALL_KINCLUDES) $(ALL_KDEFINES)
177TESTING_CFLAGS = -DTESTINGONLYTESTING $(CFLAGS)
178
179/* ***************************************************************** *\
180 * shark.rls - macro (rules) for Imakefiles
181\* ***************************************************************** */
182
183/* ***************************************************************** *\
184 * Standard Compilation Rules
185\* ***************************************************************** */
186
187/***************************************************
188 *  Export:
189 *    AppendFiles()
190 *    CleanTarget()
191 *    CppAndFilter()
192 *    DependTarget()
193 *    SharedObjectTarget()
194 *    LibraryTarget()
195 *    MkdirTarget()
196 *    NormalAsmPPRule()
197 *    NormalAsmRule()
198 *    NormalLexRule()
199 *    NativeObjectRule()
200 *    NormalObjectRule()
201 *    SharedObjectRule(shflags)
202 *    NormalYaccRule()
203 *    NidlTarget()
204 *    NativeProgramTarget()
205 *    ProgramTarget()
206 *    CProgramTarget()
207 *    TestProgramTarget()
208 *    TestingOnlyTestingRule()
209 *              MsgTarget()
210 ***************************************************/
211
212/* Linux hack to reset header include search paths for portability layer so
213   that we only try to include portability and cxi header files from GPFS */
214#ifdef GPFS_LINUX
215GPL_HEADER_DIR = $(DESTDIR)/include/gpl-linux
216GPL_LIB_DIR = $(DESTDIR)/lib/gpl-linux
217
218#define SetGplIncludePath()                             @@\
219STD_KINCLUDES = -I$(CXI_HEADER_DIR) -I$(GPL_HEADER_DIR) -I$(KERNEL_HEADER_DIR)
220
221/* Try to catch dumb mistakes in building portability layer.  Skip the check
222   if LINUX_SKIP_DIST_CHECK is defined. */
223#define CheckLinuxDistribution()
224#ifndef LINUX_SKIP_DIST_CHECK
225Headers:: @@\
226  @if [ "$(LINUX_DISTRIBUTION)" = "REDHAT_LINUX" ]; then \ @@\
227    if [ ! -f /etc/redhat-release ]; then \ @@\
228      echo "Error: the current Linux environment does not agree with the setting, LINUX_DISTRIBUTION = $(LINUX_DISTRIBUTION), specified in site.mcr!"; exit 1; \ @@\
229    else \ @@\
230      rhreltype=`awk '/Enterprise/ {print "Enterprise"}' /etc/redhat-release`; \ @@\
231      if [ "$$rhreltype" = "Enterprise" ]; then \ @@\
232        echo "Error: the current Linux environment appears to be RedHat Enterprise Linux, which requires setting LINUX_DISTRIBUTION = REDHAT_AS_LINUX in site.mcr!"; exit 1; \ @@\
233      fi; \ @@\
234    fi; \ @@\
235  elif [ "$(LINUX_DISTRIBUTION)" = "REDHAT_AS_LINUX" ]; then \ @@\
236    if [ ! -f /etc/redhat-release ]; then \ @@\
237      echo "Error: the current Linux environment does not agree with the setting, LINUX_DISTRIBUTION = $(LINUX_DISTRIBUTION), specified in site.mcr!"; exit 1; \ @@\
238    else \ @@\
239      rhreltype=`awk '/Enterprise/ {print "Enterprise"}' /etc/redhat-release`; \ @@\
240      if [ "$$rhreltype" != "Enterprise" ]; then \ @@\
241        echo "Error: the current Linux environment appears to be RedHat Linux (not Enterprise Linux [AS|ES|WS] version), which requires setting LINUX_DISTRIBUTION = REDHAT_LINUX in site.mcr!"; exit 1; \ @@\
242      fi; \ @@\
243    fi; \ @@\
244  elif [ "$(LINUX_DISTRIBUTION)" = "SUSE_LINUX" ]; then \ @@\
245    if [ ! -f /etc/SuSE-release ]; then \ @@\
246      echo "Error: the current Linux environment does not agree with the setting, LINUX_DISTRIBUTION = $(LINUX_DISTRIBUTION), specified in site.mcr!"; exit 1; \ @@\
247    fi; \ @@\
248  elif [ "$(LINUX_DISTRIBUTION)" = "KERNEL_ORG_LINUX" ]; then \ @@\
249    echo "This is OK" > /dev/null; \ @@\
250  else \ @@\
251    echo "Error: LINUX_DISTRIBUTION = '$(LINUX_DISTRIBUTION)' is not a valid choice in site.mcr!"; exit 1; \ @@\
252  fi;
253#endif /* LINUX_SKIP_DIST_CHECK */
254#endif /* GPFS_LINUX */
255
256#define NativeObjectRule()                              @@\
257.C.o:                                                   @@\
258  $(RM) $@                                        @@\
259  $(NATIVE_CC) -c $(NATIVECFLAGS) $*.C            @@\
260.c.o:                                                   @@\
261  $(RM) $@                                        @@\
262  $(NATIVE_C_COMP) -c $(NATIVECFLAGS) $*.c
263
264#define LinuxKernelObjectRule()       @@\
265.c.ko:                                                  @@\
266  $(RM) $@                                        @@\
267  $(C_COMP) -o $@ -c $(KCFLAGS) $*.c           
268
269#define NormalObjectRule()        @@\
270.C.o:             @@\
271  $(RM) $@          @@\
272  $(CC) -c $(CFLAGS) $*.C       @@\
273.C.32o:             @@\
274  $(RM) $@          @@\
275  $(CC) -c $(CFLAGS) $(CFLAGS32) $*.C -o $*.32o @@\
276.C.64o:             @@\
277  $(RM) $@          @@\
278  $(CC) -c $(CFLAGS) $(CFLAGS64) $*.C -o $*.64o   @@\
279.c.o:             @@\
280  $(RM) $@          @@\
281  $(C_COMP) -c $(CFLAGS) $*.c     @@\
282.c.32o:             @@\
283  $(RM) $@          @@\
284  $(C_COMP) -c $(CFLAGS) $(CFLAGS32) $*.c -o $*.32o @@\
285.c.64o:             @@\
286  $(RM) $@          @@\
287  $(C_COMP) -c $(CFLAGS) $(CFLAGS64) $*.c -o $*.64o @@\
288LinuxKernelObjectRule()       @@\
289.C.ko:              @@\
290  $(RM) $@          @@\
291  $(CC) -o $@ -c $(KCFLAGS) $*.C            @@\
292.S.o:             @@\
293  $(RM) $@          @@\
294  $(CC) -o $@ -c $(CFLAGS) $*.S                   @@\
295.S.ko:              @@\
296  $(RM) $@          @@\
297  $(CC) -o $@ -c $(KCFLAGS) $*.S              @@\
298.c.pko:             @@\
299  $(RM) $@          @@\
300  $(C_COMP) -o $@ -c $(PATCHED_KERNEL_FLAGS) $(KCFLAGS) $*.c  @@\
301.C.pko:             @@\
302  $(RM) $@          @@\
303  $(CC) -o $@ -c $(PATCHED_KERNEL_FLAGS) $(KCFLAGS) $*.C  @@\
304.rpc.h:             @@\
305  $(MKRPC) $*.rpc
306
307
308#define SharedObjectRule(shflags)       @@\
309.C.o:               @@\
310  $(RM) $@            @@\
311  $(CC) -c $(CFLAGS) shflags $*.C       @@\
312.c.o:               @@\
313  $(RM) $@            @@\
314  $(C_COMP) -c $(CFLAGS) shflags $*.c     @@\
315.c.ko:                @@\
316  $(RM) $@            @@\
317  $(C_COMP) -o $@ -c $(KCFLAGS) shflags $*.c    @@\
318.C.ko:                @@\
319  $(RM) $@            @@\
320  $(CC) -o $@ -c $(KCFLAGS) shflags $*.C            @@\
321.S.o:               @@\
322  $(RM) $@            @@\
323  $(CC) -o $@ -c $(CFLAGS) shflags $*.S                   @@\
324.S.ko:                @@\
325  $(RM) $@            @@\
326  $(CC) -o $@ -c $(KCFLAGS) shflags $*.S
327
328#define NormalYaccRule()        @@\
329.y.o:             @@\
330  $(YACC) $(YFLAGS) $<        @@\
331  $(MV) y.tab.c $*.c        @@\
332  $(NATIVE_C_COMP) -c ${NATIVECFLAGS} $*.c  @@\
333  $(RM) $*.c          @@\
334  [ -f y.tab.h ] && $(MV) -f y.tab.h $*.h
335
336
337#define NormalAsmPPRule()       @@\
338.spp.o:             @@\
339  $(RM) $@ ,$*.s ,$*.c        @@\
340  $(CP) $*.spp ,$*.c        @@\
341  $(C_COMP) -E $(CFLAGS)  ,$*.c > ,$*.s   @@\
342  $(AS) -o $*.o ,$*.s       @@\
343  $(RM) ,$*.c ,$*.s
344
345
346#define NormalLexRule()         @@\
347.l.o:             @@\
348  $(LEX) $*.l         @@\
349  $(RM) $*.c          @@\
350  $(MV) lex.yy.c $*.c       @@\
351  $(C_COMP) -c $(CFLAGS) $*.c     @@\
352  $(RM) $*.c
353
354
355#define NormalAsmRule()         @@\
356.s.o:             @@\
357  $(RM) $@          @@\
358  $(AS) -o $*.o $*.s
359
360#define SharkAsmRule()          @@\
361.s.o:             @@\
362  $(RM) $@          @@\
363  m4 $(M4FLAGS) $(ALL_DEFINES) -I/usr/include /usr/include/sys/asdef.s $*.s | as $(ASFLAGS) -o $*.o
364
365#define ShellScriptRule(File)       @@\
366.sh:              @@\
367  cp $< $@; chmod 0777 $@
368
369#define RpmRule(rpmfile, specfile, imagetree, rpmflags)   @@\
370rpm:: rpmfile           @@\
371rpmfile: specfile         @@\
372  $(RM) rpmfile         @@\
373  if [ -e imagetree ]; then \     @@\
374    $(RM) -r imagetree; \     @@\
375  fi;           @@\
376  [ -e $(RPMBUILD) ] && rpmbuild=$(RPMBUILD) || rpmbuild=rpm; \@@\
377  $$rpmbuild -ba rpmflags --buildroot imagetree specfile
378
379#define CppAndFilter(file, lyfile, incfiles, filter)  @@\
380file: lyfile incfiles         @@\
381  $(RM) file          @@\
382  $(CPP) lyfile | filter > file
383
384#define AppendFiles(target, sources)      @@\
385target: sources           @@\
386  $(RM) target          @@\
387  cat sources > target
388
389#define TestingOnlyTestingRule(libs, syslibs)     @@\
390.SUFFIXES: .test            @@\
391.c.test:              @@\
392  $(RM) $@            @@\
393  $(C_COMP) $(TESTING_CFLAGS) -o $*.test $*.c libs syslibs  @@\
394  $(RM) $*.o            @@\
395clean:: ; $(RM) *.test
396
397#define LibraryTarget(library, objs)      @@\
398libs:: library            @@\
399library: objs           @@\
400  $(RM) $@          @@\
401  $(AR) $(ARFLAGS) $@ objs
402
403#define kLibraryTarget(library, objs)     @@\
404libs:: library            @@\
405library: objs           @@\
406  $(RM) $@          @@\
407  $(KAR) $(KARFLAGS) $@ objs
408
409#ifndef GPFS_LINUX
410#define SharedObjectTarget(shared, objs, imps, exps, other) @@\
411shared: objs imps exps          @@\
412  $(RM) $@          @@\
413  @ IMPS= ; EXPS= ; COL=\: ; \      @@\
414    for i in imps ; \       @@\
415      do IMPS="$${IMPS} -bI$${COL}$${i}" ; \  @@\
416    done; \         @@\
417    for i in exps ; \       @@\
418      do EXPS="$${EXPS} -bE$${COL}$${i}" ; \  @@\
419    done; \         @@\
420  echo "  ld -o $@ objs $(LDFLAGS2) -bnoentry -bM\:SRE $${IMPS} $${EXPS} other" ; \ @@\
421  ld -o $@ objs $(LDFLAGS2) -bnoentry -bM\:SRE $${IMPS} $${EXPS} other
422#else   /* GPFS_LINUX */
423#define SharedObjectTarget(shared_obj, objs, other) @@\
424libs:: shared_obj         @@\
425shared_obj: objs          @@\
426  $(RM) $@          @@\
427  echo "  $(BARELD) $(LDFLAGS2) -o $@ objs --shared other" ;  \ @@\
428  $(BARELD) $(LDFLAGS2) -o $@ objs --shared other
429#endif  /* GPFS_LINUX */
430
431
432#define TestProgramTarget(program, objs, libs, syslibs) @@\
433test:: program            @@\
434program: objs libs          @@\
435  $(RM) $@          @@\
436  $(LD) -o $@ objs libs $(STD_LDFLAGS) $(IMAKE_LDFLAGS) $(ALL_LIBPATHS) syslibs @@\
437cleanTest:: ; $(RM) program objs      @@\
438clean:: ; $(RM) program
439
440#ifndef GPFS_LINUX
441#define MsgTarget(basename)                             @@\
442headers:: basename/**/_msg.h        @@\
443basename/**/_msg.h: basename.msg              @@\
444  $(RM) basename/**/_msg.h      @@\
445  mkcatdefs basename basename.msg | gencat $(DESTDIR)/mmfs.cat  @@\
446clean:: ; $(RM) basename/**/_msg.h
447#else
448#define MsgTarget(basename)                             @@\
449headers:: basename/**/_msg.h        @@\
450basename/**/_msg.h: basename.msg              @@\
451  $(RM) basename/**/_msg.h      @@\
452  gencat -H basename/**/_tmp.h -o $(DESTDIR)/mmfs.cat basename/**/.msg @@\
453  sed "s/AutomaticSet[0-9]*/ /" basename/**/_tmp.h > basename/**/_msg.h @@\
454  $(RM) basename/**/_tmp.h      @@\
455clean:: ; $(RM) basename/**/_msg.h
456#endif
457
458#define ShellMsgTarget(basename)      @@\
459headers:: basename/**/_msg.h        @@\
460basename/**/_msg.h:: basename.msg             @@\
461  $(RM) basename/**/_msg.h      @@\
462  mkcatdefs basename basename.msg -h | gencat $(DESTDIR)/mmfs.cat @@\
463basename/**/_msg.h:: basename.msg             @@\
464  touch basename/**/_msg.h      @@\
465clean:: ; $(RM) basename/**/_msg.h
466
467#define TraceTarget(basename,files)                     @@\
468trcid: files                                            @@\
469  $(MKTRACE) -hm files                            @@\
470trclst:: basename.trclst                                @@\
471basename.trclst: files trcid.h                          @@\
472  $(RM) basename.trclst                           @@\
473  $(MKTRACE) -l basename.trclst files             @@\
474clean:: ; $(RM) basename.trclst
475
476#define RpcTarget(target)                               @@\
477target.h: target.rpc
478
479#define NidlTarget(basename)        @@\
480libs:: basename.h         @@\
481depend:: basename.h         @@\
482basename.h: basename.idl        @@\
483  $(NIDL) basename.idl $(NIDLINCLUDES) -no_cpp  @@\
484clean::             @@\
485  $(RM) basename.h        @@\
486  @(for i in basename; do \     @@\
487  echo "  "$(RM) $${i}C.c $${i}S.c $${i}W.c; \  @@\
488  $(RM) $${i}C.c $${i}S.c $${i}W.c; \   @@\
489  done)
490
491
492#define NativeProgramTarget(program, objs, libs, syslibs)     @@\
493all:: program                                           @@\
494program: objs libs                                      @@\
495  $(RM) $@                                        @@\
496  $(NATIVE_LD) -o $@ objs libs $(STD_LDFLAGS) $(IMAKE_LDFLAGS) $(ALL_LIBPATHS) syslibs    @@\
497clean:: ; $(RM) program
498 
499#define ProgramTarget(program, objs, libs, syslibs) @@\
500all:: program           @@\
501program: objs libs          @@\
502  $(RM) $@          @@\
503  $(LD) -o $@ objs libs $(STD_LDFLAGS) $(IMAKE_LDFLAGS) $(ALL_LIBPATHS) syslibs  @@\
504clean:: ; $(RM) program
505
506#define CProgramTarget(program, objs, libs, syslibs)  @@\
507all:: program           @@\
508program: objs libs          @@\
509  $(RM) $@          @@\
510  $(C_COMP) -o $@ objs libs $(STD_LDFLAGS) $(IMAKE_LDFLAGS) $(ALL_LIBPATHS) syslibs @@\
511clean:: ; $(RM) program
512
513#define CTestProgramTarget(program, objs, libs, syslibs)  @@\
514test:: program            @@\
515program: objs libs          @@\
516  $(RM) $@          @@\
517  $(C_COMP) -o $@ objs libs $(STD_LDFLAGS) $(IMAKE_LDFLAGS) $(ALL_LIBPATHS) syslibs @@\
518clean:: ; $(RM) program
519
520#define CleanTarget(files)        @@\
521clean:: ; $(RM) files
522
523#define MkdirTarget(dirs)       @@\
524install.ti:: makedirs         @@\
525  @echo '\c'          @@\
526install.he:: makedirs         @@\
527  @echo '\c'          @@\
528makedirs::            @@\
529  @echo "Checking Destination Directories...."  @@\
530  @sh -c 'for i in dirs;  do  \     @@\
531    if [ -f $$i ]; then  \      @@\
532      echo "Mkdir: $$i is a FILE"; \  @@\
533      exit 1; \     @@\
534    elif [ ! -d $$i ]; then  \    @@\
535      echo "Making directory $$i"; \  @@\
536      mkdir -p $$i; \     @@\
537    fi; \         @@\
538  done; \           @@\
539  exit 0'
540
541#define DependTarget(dependencies)      @@\
542depend:: dependencies         @@\
543  $(DEPENDSCRIPT) "$(MAKEDEPEND)" \     @@\
544  "$(ALL_KINCLUDES) $(CPLUSINC) -I/" "$(ALL_DEFINES)"
545/* -I/ added to circumvent grossness of makedepend */
546
547#define DependTargetK(dependencies)     @@\
548depend:: dependencies         @@\
549  $(DEPENDSCRIPT) "$(MAKEDEPEND)" \     @@\
550  "$(ALL_KINCLUDES) $(CPLUSINC) -I/" "$(ALL_DEFINES)" "$(ALL_KDEFINES)"
551/* -I/ added to circumvent grossness of makedepend */
552
553#define DependTargetPK(dependencies)      @@\
554depend:: dependencies         @@\
555  $(DEPENDSCRIPT) "$(MAKEDEPEND)" \     @@\
556  "$(ALL_KINCLUDES) $(CPLUSINC) -I/" "$(ALL_DEFINES) -D__KERNEL__" "$(ALL_KDEFINES) -D__KERNEL__" "$(PATCHED_KERNEL_FLAGS) -D__KERNEL__"
557
558/*
559 *==================================================
560 * Installation rules
561 *==================================================
562 * Exported rules:
563 *  InstallDocs()
564 *  InstallFileToFile()
565 *  InstallFiles()
566 *  InstallHeaders()
567 *  InstallPatchedHeaders()
568 *  InstallHardLink()
569 *  InstallLibraries()
570 *  InstallLink()
571 *  InstallPrograms()
572 *==================================================
573 */
574
575INSTUIDFLAGS = -c -m 4555
576INSTLIBFLAGS = -c -m 0664
577INSTINCFLAGS = -c -m 0444
578INSTDOCFLAGS = -c -m 0444
579INSTROOTFLAGS = -c $(EXTRAINSTROOTFLAGS) -m 0500
580INSTROOTFLAGS2 = -c -m 0500
581INSTPROGFLAGS = -c $(EXTRAINSTPROGFLAGS) -m 0555
582INSTSHELLFLAGS = -c -m 0755
583
584DASH_I  = *-[^=\ ][i]*
585DASH_IK = *-[^=\ ][ik]*
586
587#define InstallFiles(files, mode, dest)       @@\
588install.ti:: files            @@\
589  @(case '$(MAKEFLAGS)' in $(DASH_I)) set +e;; esac; \  @@\
590        changed="$?"; \             @@\
591  for i in $$changed; do \        @@\
592    (set -x; $(INSTALL) mode $$i dest/$$i) done)
593
594#define InstallHeaders(files, dest)       @@\
595install.he:: files            @@\
596  @(case '$(MAKEFLAGS)' in $(DASH_I)) set +e;; esac; \  @@\
597        changed="$?"; \           @@\
598  for i in $$changed; do \        @@\
599    (set -x; $(INSTALL) $(INSTINCFLAGS) $$i dest/$$i) done)
600
601#define InstallPatchedHeaders(files, src, dest)       @@\
602install.he:: files              @@\
603  @(case '$(MAKEFLAGS)' in $(DASH_I)) set +e;; esac; \    @@\
604  changed="$?"; \             @@\
605  for i in $$changed; do \          @@\
606    ($(PATCHSCRIPT) src dest $$i) done)
607
608#define InstallLibraries(libs, dest)        @@\
609library.ti:: libs           @@\
610  @(case '$(MAKEFLAGS)' in $(DASH_I)) set +e;; esac; \  @@\
611        changed="$?"; \           @@\
612  for i in $$changed; do \        @@\
613    (set -x; \          @@\
614    $(INSTALL) $(INSTLIBFLAGS) $$i dest/$$i ) done)
615
616#define InstallFileToFile(file, mode, destfile)     @@\
617install.ti:: file           @@\
618  $(INSTALL) mode file destfile
619
620#define ShipSupport(Destination)        @@\
621shipSupport:: $(SHIP_ROOT)/usr/lpp/$(LPP_NAME)/Destination  @@\
622$(SHIP_ROOT)/usr/lpp/$(LPP_NAME)/Destination: $(@F)   @@\
623  [ -d $(@D) ] || mkdir -p $(@D)        @@\
624  cp $(@F) $@           @@\
625                @@\
626unshipSupport::             @@\
627  rm -f $(SHIP_ROOT)/usr/lpp/$(LPP_NAME)/Destination
628
629#define ShipFile(Destination,SourceFile,ProdName,Type,Owner,Group,Mode,Class,Size,CheckSum,Links,SymLinks,Program,Source,Acl,Xacl)  @@\
630shipFile:: $(SHIP_ROOT)/Destination     @@\
631$(SHIP_ROOT)/Destination:: SourceFile     @@\
632  @[ -d $(@D) ] || mkdir -p $(@D)     @@\
633  @([ -z "ProdName" ] && prodname=$(LOCAL_PROD_NAME) ||\ @@\
634    prodname=ProdName ;\      @@\
635  [ -n "Type" ] && type=Type || type="$(SHIP_TYPE)" ;\ @@\
636  [ -n "Owner" ] && owner=Owner || owner="$(SHIP_OWNER)";\ @@\
637  [ -n "Group" ] && group=Group || group="$(SHIP_GROUP)" ;\ @@\
638  [ -n "Mode" ] && mode=Mode || mode=555 ;\ @@\
639        [ -n "Class" ] && class_inv="Class" || class_inv="$(SHIP_CLASS)" ;\ @@\
640  [ "Type" = "DIRECTORY" ] && mkdir -p $(SHIP_ROOT)/Destination ; \ @@\
641  [ -z "SourceFile" ] || $(SHIP_CMD) -o $$owner -g $$group -m $$mode SourceFile $@ ;\ @@\
642        echo "\tShipping Destination ($$prodname)" ; \  @@\
643  [ -d $(SHIPDIR) ] || mkdir -p $(SHIPDIR) ; \  @@\
644  touch $(SHIPDIR)/$$prodname.il ||\    @@\
645        (echo "\nERROR: Failed to create file SHIPDIR/usr/lpp/$(LPP_NAME)/$$prodname.il" && exit 1) ;\          @@\
646        echo "Destination:" >> $(SHIPDIR)/$$prodname.il ;\ @@\
647        echo "\ttype = $$type" >> $(SHIPDIR)/$$prodname.il ;\ @@\
648        echo "\towner = $$owner" >> $(SHIPDIR)/$$prodname.il ;\ @@\
649        echo "\tgroup = $$group" >> $(SHIPDIR)/$$prodname.il ;\ @@\
650  if [ $$mode -gt 999 ] ; then \      @@\
651    if [ $$mode -ge 4000 -a $$mode -le 4999 ] ; then \ @@\
652      echo "\tmode = SUID,`expr $$mode - 4000`" >> \  @@\
653        $(SHIPDIR)/$$prodname.il ;\ @@\
654    elif [ $$mode -ge 2000 -a $$mode -le 2999 ] ; then \ @@\
655      echo "\tmode = SGID,`expr $$mode - 2000`" >> \  @@\
656        $(SHIPDIR)/$$prodname.il ;\ @@\
657    else \          @@\
658      ( echo "\nERROR: Unrecognized mode value $$mode" && exit 1 ); \     @@\
659    fi \          @@\
660  else \            @@\
661    echo "\tmode = $$mode" >> $(SHIPDIR)/$$prodname.il ;\ @@\
662  fi ; \            @@\
663  if [ "Type" != "DIRECTORY" ] ; then \   @@\
664    echo "\tclass = inventory,$$class_inv,$${prodname}" >> \ @@\
665      $(SHIPDIR)/$$prodname.il ;\   @@\
666    [ -z "Size" ] && echo "\tsize = `cksum < $@ | \ @@\
667       /bin/awk '{print $$2}'`" >> $(SHIPDIR)/$$prodname.il || \ @@\
668       echo "\tsize = Size" >> $(SHIPDIR)/$$prodname.il ; \ @@\
669  else \              @@\
670          echo "\tclass = $$class_inv,$${prodname}" >> \ @@\
671      $(SHIPDIR)/$$prodname.il ;\   @@\
672  fi ;\         @@\
673        [ -n "CheckSum" ] && echo "\tchecksum = CheckSum" >> $(SHIPDIR)/$$prodname.il || true ;\ @@\
674        [ -z "CheckSum" -a \( "Size" = "VOLATILE" \) ] && echo "\tchecksum = VOLATILE" >> $(SHIPDIR)/$$prodname.il || true ;\ @@\
675        [ -n "Links" ] && echo "\tlinks = Links" >> $(SHIPDIR)/$$prodname.il || true ;\ @@\
676        [ -n "SymLinks" ] && echo "\tsymlinks = SymLinks" >> $(SHIPDIR)/$$prodname.il || true ;\ @@\
677        [ -n "Program" ] && echo "\tprogram = Program" >> $(SHIPDIR)/$$prodname.il || true ;\ @@\
678        [ -n "Source" ] && echo "\tsource = Source\n" >> $(SHIPDIR)/$$prodname.il || true ;\ @@\
679        [ -n "Acl" ] && echo "\tacl = Acl\n" >> $(SHIPDIR)/$$prodname.il || true ;\ @@\
680        [ -n "Xacl" ] && echo "\txacl = Xacl\n" >> $(SHIPDIR)/$$prodname.il || true ;\ @@\
681        )   @@\
682    @@\
683unshipFile::  @@\
684  -if [ -n "Destination" ] ; then \       @@\
685    [ ! -f $(SHIP_ROOT)/Destination ] || rm -f $(SHIP_ROOT)/Destination ;\ @@\
686    [ ! -d $(SHIP_ROOT)/Destination ] || rmdir $(SHIP_ROOT)/Destination ;\ @@\
687  fi                @@\
688  @([ -z "ProdName" ] && prodname=$(LOCAL_PROD_NAME) || \   @@\
689    prodname=ProdName ;\          @@\
690  rm -f $(SHIP_ROOT)/usr/lpp/$(LPP_NAME)/$${prodname}.il )
691
692#define InstallDocs(docs, mode, dest)         @@\
693install.ti:: docs             @@\
694  @(case '$(MAKEFLAGS)' in $(DASH_I)) set +e;; esac; \    @@\
695        changed="$?"; \             @@\
696  for i in $$changed; do \          @@\
697    (set -x; $(INSTALL) $(INSTDOCFLAGS) $$i dest/$$i); \  @@\
698  done)
699
700
701#define InstallPrograms(files, dest)      @@\
702InstallFiles(files, $(INSTPROGFLAGS), dest)
703
704#define InstallRootPrograms(files, dest)    @@\
705InstallFiles(files, $(INSTROOTFLAGS), dest)
706
707#define InstallUidPrograms(files, dest)     @@\
708InstallFiles(files, $(INSTUIDFLAGS), dest)
709
710#define InstallHardLink(file, link)     @@\
711install.ti:: file         @@\
712  $(RM) link          @@\
713  ln file link
714
715#define InstallLink(file, link)       @@\
716install.ti::            @@\
717  $(RM) link          @@\
718  $(LN) file link
719
720/* ***************************************************************** *\
721 * Internal (to template) rules
722\* ***************************************************************** */
723#define GenericCleanTarget()          @@\
724clean::                 @@\
725  $(RM) _POUND_* ,* *~ *.CKP *.BAK *.bak core   @@\
726  $(RM) *.ln *.o *.32o *.64o *.po *.ko *.pko make.log *.a *.lst *.map *.so @@\
727  $(RM) install.ti install.he library.ti *.rpm
728
729#define MakefileTarget()            @@\
730makefile:: Imakefile $(IRULESRC)/imake.tmpl $(IRULESRC)/site.mcr  @@\
731    $(IMAKE_CMD); \           @@\
732    touch .depends; \         @@\
733    cat .depends >>makefile
734
735#define SubdirTarget(dirs, mktag, string)       @@\
736mktag::                 @@\
737  @(case '$(MAKEFLAGS)' in $(DASH_IK)) set +e;; esac; \   @@\
738  for i in dirs; do \           @@\
739      (cd $$i || exit $$?; \        @@\
740    echo string "(`pwd`)"; \        @@\
741    $(MAKE) $(MAKEDASH)$(MAKEFLAGS) $(MAKEEXTRA) DESTDIR=$(DESTDIR) mktag; \  @@\
742    exit $$?) || exit 1; \          @@\
743  done)
744
745#define MakeSubdirs(dirs)       @@\
746SubdirTarget(dirs, All, "making")
747
748#define InstallSubdirs(dirs)        @@\
749SubdirTarget(dirs, Install, "installing")
750
751#define InstLibSubdirs(dirs)        @@\
752SubdirTarget(dirs, InstallLibs, "Make-Install-Libraries-ing")
753
754#define LibSubdirs(dirs)        @@\
755SubdirTarget(dirs, Libs, "Make-Libraries-ing")
756
757#define MakeTestSubdirs(dirs)       @@\
758SubdirTarget(dirs, Test, "Make-Testing")
759
760#define dependInstallSubdirs(dirs)      @@\
761SubdirTarget(dirs, dependInstall, "depend-Installing")
762
763#define DependSubdirs(dirs)       @@\
764SubdirTarget(dirs, Depend, "Depending")
765
766#define CleanTestSubdirs(dirs)        @@\
767SubdirTarget(dirs, CleanTest, "cleaning tests")
768
769#define CleanSubdirs(dirs)        @@\
770SubdirTarget(dirs, Clean, "cleaning")
771
772#define CheckinSubdirs(dirs)        @@\
773SubdirTarget(dirs, Checkin, "checking mods in")
774
775#define ShipSubdirs(dirs)       @@\
776SubdirTarget(dirs, Ship, "Shipping")
777
778#define UnshipSubdirs(dirs)       @@\
779SubdirTarget(dirs, Unship, "Unshipping")
780
781#define HeaderSubdirs(dirs)       @@\
782SubdirTarget(dirs, Headers, "installing header files")
783
784#define MakeMakeSubdirs(dirs)         @@\
785Makefiles::             @@\
786  @(case '$(MAKEFLAGS)' in $(DASH_IK)) set +e;; esac; \ @@\
787  for i in dirs; do \         @@\
788    echo "Making Makefiles (`pwd`/$$i)"; \    @@\
789    $(MAKE) subdirMakefiles \     @@\
790    MAKE_SUBDIR=$$i || exit $$?; \      @@\
791  done)
792
793#define MakefileSubdirs(dirs)       @@\
794MakeMakeSubdirs(dirs)         @@\
795              @@\
796subdirMakefiles:          @@\
797  cd $(MAKE_SUBDIR) || exit $$?; \    @@\
798  $(DOTDOTIMAKE_CMD); \       @@\
799  touch .depends;  \        @@\
800  cat .depends >>makefile; \      @@\
801  $(MAKE) $(MAKEDASH)$(MAKEFLAGS) $(MAKEEXTRA) Makefiles
802
803all:: libs
804All:: all
805test::
806Test:: test
807libs:: headers
808Libs:: libs
809installLibs:: trclst
810trclst::
811installLibs:: libs
812installLibs:: library.ti
813InstallLibs:: installLibs
814instLibs:: installLibs
815InstLibs:: InstallLibs
816rpm::
817
818depend:: headers
819depend:: makefile
820Depend:: depend
821install.he::
822library.ti::
823headers:: install.he
824Headers:: headers
825install.ti::
826install:: headers
827install:: libs
828install:: all
829install:: install.ti
830Install:: install
831dependInstall:: depend
832dependInstall:: install
833clean::
834Clean:: clean
835cleanTest::
836CleanTest:: cleanTest
837update:: ; $(SRC_UPDATE_CMD)
838checkin:: ; $(SRC_CHECKIN_CMD)
839Checkin:: checkin
840config1::
841config2::
842finish::
843World:: config1
844World:: Makefiles
845World:: Clean
846World:: config2
847World:: Headers
848World:: Depend
849World:: InstallLibs
850World:: Install
851World:: finish
852Ship:: shipReset
853Ship:: shipSupport
854Ship:: shipFile
855Unship:: unshipSupport
856Unship:: unshipFile
857
858shipReset::
859
860GenericCleanTarget()
861#ifndef BOOTSTRAP
862MakefileTarget()
863#endif
864
865_POUND_##################################################
866_POUND_ The following comes from the local Imakefile
867_POUND_##################################################
868#include INCLUDE_IMAKEFILE
869_POUND_##################################################
870_POUND_ Back from the local Imakefile
871_POUND_##################################################
872
873Makefiles:: makefile
874
875#ifdef IHaveSubdirs
876
877MakeSubdirs($(SUBDIRS) $(EXTRASUBDIRS))
878InstallSubdirs($(SUBDIRS))
879MakeTestSubdirs($(SUBDIRS) $(EXTRASUBDIRS))
880dependInstallSubdirs($(SUBDIRS))
881DependSubdirs($(SUBDIRS))
882CleanTestSubdirs($(SUBDIRS) $(EXTRASUBDIRS))
883CleanSubdirs($(SUBDIRS) $(EXTRASUBDIRS))
884CheckinSubdirs($(SUBDIRS) $(EXTRASUBDIRS))
885MakefileSubdirs($(SUBDIRS) $(EXTRASUBDIRS))
886HeaderSubdirs($(SUBDIRS) $(EXTRASUBDIRS))
887LibSubdirs($(SUBDIRS) $(EXTRASUBDIRS))
888InstLibSubdirs($(SUBDIRS) $(EXTRASUBDIRS))
889ShipSubdirs($(SUBDIRS))
890UnshipSubdirs($(SUBDIRS))
891
892#endif
893
894installLibs::afterInstallLibs
895
896afterInstallLibs::
897
898shipFile shipSupport::
899
900unshipFile unshipSupport::
901
902library.ti::
903  touch library.ti
904
905install.he::
906  touch install.he
907
908install.ti::
909  touch install.ti
910
911listdirs:
912  @echo ${SUBDIRS}
913
914_POUND_#### DEPENDENCY LINE - DO NOT DELETE #####
Note: See TracBrowser for help on using the repository browser.