Commit | Line | Data |
a0d0e21e |
1 | : This forces SH files to create target in same directory as SH file. |
2 | : This is so that make depend always knows where to find SH derivatives. |
3 | |
4 | case "$0" in |
5 | */*) cd `expr X$0 : 'X\(.*\)/'` ;; |
6 | esac |
7 | |
8 | if test -f config.sh; then TOP=.; |
9 | elif test -f ../config.sh; then TOP=..; |
10 | elif test -f ../../config.sh; then TOP=../..; |
11 | elif test -f ../../../config.sh; then TOP=../../..; |
12 | elif test -f ../../../../config.sh; then TOP=../../../..; |
13 | else |
14 | echo "Can't find config.sh."; exit 1 |
15 | fi |
16 | |
17 | : Find absolute path name for TOP. This is needed when we cd to TOP |
18 | : to run perl on autosplit. |
19 | oldpwd=`pwd`; cd $TOP; ABSTOP=`pwd`; cd $oldpwd |
20 | |
21 | case $CONFIG in |
22 | '') |
23 | . $TOP/config.sh |
24 | ;; |
25 | esac |
26 | |
27 | : Find out directory name. This is also the extension name. |
28 | ext=`pwd | $sed -e 's@.*/@@'` |
29 | |
30 | : This extension might have its own typemap |
31 | if test -f typemap; then |
32 | exttypemap='typemap' |
33 | else |
34 | exttypemap='' |
35 | fi |
36 | |
37 | : This extension might need additional libraries. |
38 | potential_libs=" " |
39 | . $TOP/ext/util/extliblist |
40 | |
41 | : This extension might need bootstrap support |
42 | if test -f ${ext}_BS; then |
43 | bootdep=${ext}_BS |
44 | else |
45 | bootdep='' |
46 | fi |
47 | |
48 | case "$dlsrc" in |
49 | dl_aix*) |
50 | echo "#!" > $ext.exp |
51 | echo "boot_$ext" >> $ext.exp |
52 | ;; |
53 | esac |
54 | |
55 | echo "Extracting ext/$ext/Makefile (with variable substitutions)" |
56 | : This section of the file will have variable substitutions done on it. |
57 | : Move anything that needs config subs from !NO!SUBS! section to !GROK!THIS!. |
58 | : Protect any dollar signs and backticks that you do not want interpreted |
59 | : by putting a backslash in front. You may delete these comments. |
60 | $spitshell >Makefile << !GROK!THIS! |
61 | # |
62 | # This Makefile is for the $ext extension to perl. |
63 | # |
64 | CC = $cc |
65 | RANLIB = $ranlib |
66 | TOP = $TOP |
67 | ABSTOP = $ABSTOP |
68 | LDFLAGS = $ldflags |
69 | CLDFLAGS = $ldflags |
70 | SMALL = $small |
71 | LARGE = $large $split |
72 | |
73 | # To use an alternate make, set \$altmake in config.sh. |
74 | MAKE = ${altmake-make} |
75 | |
76 | EXT = $ext |
77 | |
78 | # $ext might have its own typemap |
79 | EXTTYPEMAP = $exttypemap |
80 | |
81 | # $ext might have its own bootstrap support |
82 | BOOTDEP = $bootdep |
83 | BOOTSTRAP = $ext.bs |
84 | |
85 | # The following are used to build and install shared libraries for |
86 | # dynamic loading. |
87 | LDDLFLAGS = $lddlflags |
88 | CCDLFLAGS = $ccdlflags |
89 | CCCDLFLAGS = $cccdlflags |
90 | SO = $so |
91 | DLEXT = $dlext |
92 | |
93 | # $ext might need to be linked with some extra libraries. |
94 | # EXTRALIBS = full list of libraries needed for static linking. |
95 | # Only those libraries that actually exist are included. |
96 | # DYNLOADLIBS = list of those libraries that are needed but can be |
97 | # linked in dynamically on this platform. On SunOS, for |
98 | # example, this would be .so* libraries, but not archive |
99 | # libraries. The bootstrap file is installed only if |
100 | # this list is not empty. |
101 | # STATLOADLIBS = list of those libraries which must be statically |
102 | # linked into the shared library. On SunOS 4.1.3, |
103 | # for example, I have only an archive version of |
104 | # -lm, and it must be linked in statically. |
105 | EXTRALIBS = $extralibs |
106 | DYNALOADLIBS = $dynaloadlibs |
107 | STATLOADLIBS = $statloadlibs |
108 | |
109 | !GROK!THIS! |
110 | |
111 | $spitshell >>Makefile <<'!NO!SUBS!' |
112 | |
113 | # Where to put things: |
114 | AUTO = $(TOP)/lib/auto |
115 | INSTALLBOOT = $(AUTO)/$(EXT)/$(EXT).bs |
116 | INSTALLDYNAMIC = $(AUTO)/$(EXT)/$(EXT).$(DLEXT) |
117 | INSTALLSTATIC = $(EXT).a |
118 | INSTALLPM = $(TOP)/lib/$(EXT).pm |
119 | |
120 | PERL = $(ABSTOP)/miniperl |
121 | XSUBPP = $(TOP)/ext/xsubpp |
122 | SHELL = /bin/sh |
123 | CCCMD = `sh $(shellflags) $(TOP)/cflags $@` |
124 | |
125 | .c.o: |
126 | $(CCCMD) $(CCCDLFLAGS) -I$(TOP) $*.c |
127 | |
128 | all: dynamic |
129 | # Phony target to force checking subdirectories. |
130 | FORCE: |
131 | |
132 | config: |
133 | |
134 | # Target for Dynamic Loading: |
135 | dynamic: $(INSTALLDYNAMIC) $(INSTALLPM) $(INSTALLBOOT) |
136 | |
137 | $(INSTALLDYNAMIC): $(EXT).o |
138 | @test -d $(AUTO) || mkdir $(AUTO) |
139 | @test -d $(AUTO)/$(EXT) || mkdir $(AUTO)/$(EXT) |
140 | ld $(LDDLFLAGS) -o $@ $(EXT).o $(STATLOADLIBS) |
141 | |
142 | $(BOOTSTRAP): Makefile $(BOOTDEP) |
143 | $(PERL) -I$(TOP)/lib $(TOP)/ext/util/mkbootstrap $(DYNALOADLIBS) |
144 | touch $(BOOTSTRAP) |
145 | |
146 | $(INSTALLBOOT): $(BOOTSTRAP) |
147 | @test ! -s $(BOOTSTRAP) || cp $(BOOTSTRAP) $@ |
148 | |
149 | # Target for Static Loading: |
150 | static: $(INSTALLSTATIC) $(INSTALLPM) |
151 | |
152 | $(INSTALLSTATIC): $(EXT).o |
153 | ar cr $@ $(EXT).o |
154 | $(RANLIB) $@ |
155 | echo $(EXTRALIBS) >> $(TOP)/ext.libs |
156 | |
157 | $(EXT).c: $(EXT).xs $(XSUBPP) $(TOP)/ext/typemap $(EXTTYPEMAP) $(TOP)/cflags Makefile |
158 | $(PERL) $(XSUBPP) $(EXT).xs >tmp |
159 | mv tmp $@ |
160 | |
161 | $(INSTALLPM): $(EXT).pm |
162 | rm -f $@ |
163 | cp $(EXT).pm $@ |
164 | cd $(TOP); $(PERL) autosplit $(EXT) |
165 | |
166 | clean: |
167 | rm -f *.o *.a mon.out core $(EXT).c so_locations $(BOOTSTRAP) $(EXT).exp |
168 | |
169 | realclean: clean |
170 | rm -f makefile Makefile |
171 | rm -f $(INSTALLPM) $(INSTALLDYNAMIC) $(INSTALLSTATIC) $(INSTALLBOOT) |
172 | rm -rf $(AUTO)/$(EXT) |
173 | |
174 | purge: realclean |
175 | |
176 | $(EXT).o : $(TOP)/EXTERN.h |
177 | $(EXT).o : $(TOP)/perl.h |
178 | $(EXT).o : $(TOP)/embed.h |
179 | $(EXT).o : $(TOP)/config.h |
180 | $(EXT).o : $(TOP)/unixish.h |
181 | $(EXT).o : $(TOP)/handy.h |
182 | $(EXT).o : $(TOP)/regexp.h |
183 | $(EXT).o : $(TOP)/sv.h |
184 | $(EXT).o : $(TOP)/util.h |
185 | $(EXT).o : $(TOP)/form.h |
186 | $(EXT).o : $(TOP)/gv.h |
187 | $(EXT).o : $(TOP)/cv.h |
188 | $(EXT).o : $(TOP)/opcode.h |
189 | $(EXT).o : $(TOP)/op.h |
190 | $(EXT).o : $(TOP)/cop.h |
191 | $(EXT).o : $(TOP)/av.h |
192 | $(EXT).o : $(TOP)/hv.h |
193 | $(EXT).o : $(TOP)/mg.h |
194 | $(EXT).o : $(TOP)/scope.h |
195 | $(EXT).o : $(TOP)/pp.h |
196 | $(EXT).o : $(TOP)/proto.h |
197 | $(EXT).o : $(TOP)/XSUB.h |
198 | |
199 | Makefile: Makefile.SH $(TOP)/config.sh ; /bin/sh Makefile.SH |
200 | $(TOP)/config.h: $(TOP)/config.sh; cd $(TOP); /bin/sh config_h.SH |
201 | $(TOP)/embed.h: $(TOP)/config.sh; cd $(TOP); /bin/sh embed_h.SH |
202 | $(TOP)/cflags: $(TOP)/config.sh; cd $(TOP); /bin/sh cflags.SH |
203 | |
204 | !NO!SUBS! |
205 | chmod 644 Makefile |
206 | $eunicefix Makefile |
207 | |