Fixes for OpenBSD
[oweals/cde.git] / cde / config / cf / sv4Lib.rules
1 XCOMM $TOG: sv4Lib.rules /main/19 1999/03/22 16:26:02 mgreess $
2
3 /*
4  * SVR4 shared library rules
5  */
6
7 #ifndef HasSharedLibraries
8 # define HasSharedLibraries YES
9 #endif
10 #ifndef SharedDataSeparation
11 # define SharedDataSeparation NO
12 #endif
13 #ifndef SharedCodeDef
14 # define SharedCodeDef /**/
15 #endif
16 #ifndef SharedLibraryDef
17 # define SharedLibraryDef /**/
18 #endif
19 #ifndef ShLibIncludeFile
20 # define ShLibIncludeFile <sv4Lib.tmpl>
21 #endif
22 #ifndef SharedLibraryLoadFlags
23 # define SharedLibraryLoadFlags -G -z text
24 #endif
25 #ifndef PositionIndependentCFlags
26 # if HasGcc2
27 #  define PositionIndependentCFlags -fPIC
28 # else
29 #  define PositionIndependentCFlags -K PIC
30 # endif
31 #endif
32 #ifndef PositionIndependentCplusplusFlags
33 # if HasGcc2ForCplusplus
34 #  define PositionIndependentCplusplusFlags -fpic
35 # else
36 #  define PositionIndependentCplusplusFlags -K PIC
37 # endif
38 #endif
39 #ifndef UseExportLists
40 # define UseExportLists NO
41 #endif
42
43 /*
44  * InstallSharedLibrary - generate rules to install the shared library.
45  */
46 #ifndef InstallSharedLibrary
47 # define InstallSharedLibrary(libname,rev,dest)                         @@\
48 install:: Concat(lib,libname.so.rev)                                    @@\
49         MakeDir($(DESTDIR)dest)                                         @@\
50         $(INSTALL) $(INSTALLFLAGS) $(INSTLIBFLAGS) Concat(lib,libname.so.rev) $(DESTDIR)dest @@\
51         $(RM) Concat($(DESTDIR)dest/lib,libname.so)                     @@\
52         cd $(DESTDIR)dest; $(LN) Concat(lib,libname.so.rev) Concat(lib,libname.so)
53
54 #endif /* InstallSharedLibrary */
55
56 /*
57  * InstallSharedLibraryData - generate rules to install the shared library data
58  */
59 #ifndef InstallSharedLibraryData
60 # define InstallSharedLibraryData(libname,rev,dest)
61 #endif /* InstallSharedLibraryData */
62
63 #ifndef LinkWithExports
64 # if defined(SunArchitecture)
65 #  if HasGcc2
66 #   define LinkWithExports(libname,rev,solist,down,up) \
67         (cd down; $(CC) -o up/$@~ $(SHLIBLDFLAGS) -Wl,-soname,$@ solist $(REQUIREDLIBS))
68 #  else
69 #   define LinkWithExports(libname,rev,solist,down,up) \
70         (cd down; $(CCENVSETUP) $(CXX) -o up/$@~ $(SHLIBLDFLAGS) -h $@ solist $(REQUIREDLIBS))
71 #  endif
72 # else
73 #  if UseExportLists
74 #   define LinkWithExports(libname,rev,solist,down,up) \
75         (cd down; $(CCENVSETUP) $(LD) -o up/$@~ $(SHLIBLDFLAGS) -h $@ solist $(REQUIREDLIBS))   @@\
76         if [ -f Concat(lib,libname.elist) ]; then \                     @@\
77             $(RM) down/$@.exports $@.list; \                            @@\
78             $(CPP) $(ALLINCLUDES) $(EXTRA_DEFINES) $(PROTO_DEFINES) $(THREADS_DEFINES) $(DEFINES) Concat(lib,libname.elist) | CppSedMagic >$@.list; \   @@\
79             $(EXPORTLISTGEN) $@~ $@.list > down/$@.exports; \           @@\
80             (cd down; $(CCENVSETUP) $(LD) -o up/$@~ $(SHLIBLDFLAGS) -h $@ ShlibExportListOpt($@.exports) solist $(REQUIREDLIBS)); \     @@\
81             $(RM) down/$@.exports $@.list; \                            @@\
82         fi;
83 #  else
84 #   define LinkWithExports(libname,rev,solist,down,up) \
85         (cd down; $(CCENVSETUP) $(LD) -o up/$@~ $(SHLIBLDFLAGS) -h $@ solist $(REQUIREDLIBS))
86 #  endif
87 # endif
88 #endif
89
90 /*
91  * SharedLibraryTarget - generate rules to create a shared library;
92  * build it into a different name so that we do not hose people by having
93  * the library gone for long periods.
94  */
95 #ifndef SharedLibraryTarget
96 # define SharedLibraryTarget(libname,rev,solist,down,up)                @@\
97 AllTarget(Concat(lib,libname.so.rev))                                   @@\
98                                                                         @@\
99 Concat(lib,libname.so.rev):  solist $(EXTRALIBRARYDEPS)                 @@\
100         $(RM) $@~                                                       @@\
101         LinkWithExports(libname,rev,solist,down,up)                     @@\
102         $(RM) $@                                                        @@\
103         $(MV) $@~ $@                                                    @@\
104         $(RM) Concat(lib,libname.so)                                    @@\
105         $(LN) $@ Concat(lib,libname.so)                                 @@\
106         LinkBuildLibrary($@)                                            @@\
107         LinkBuildLibrary(Concat(lib,libname.so))                        @@\
108                                                                         @@\
109 clean::                                                                 @@\
110         $(RM) Concat(lib,libname.so.rev) Concat(lib,libname.so)
111
112 #endif /* SharedLibraryTarget */
113
114 /*
115  * SharedLibraryDataTarget - generate rules to create shlib data file;
116  */
117 #ifndef SharedLibraryDataTarget
118 # define SharedLibraryDataTarget(libname,rev,salist)
119 #endif /* SharedLibraryTarget */