source: trunk/third/perl/os2/Makefile.SHs @ 10724

Revision 10724, 6.6 KB checked in by ghudson, 27 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r10723, which included commits to RCS files with non-trunk default branches.
Line 
1# This file is read by Makefile.SH to produce rules for $(LIBPERL) (and
2# some additional rules as well).
3
4# Rerun `sh Makefile.SH; make depend' after making any change.
5
6# Additional rules supported: perl_, aout_test, aout_install, use them
7# for a.out style perl (which may fork).
8
9$spitshell >>Makefile <<!GROK!THIS!
10
11AOUT_CCCMD      = \$(CC) $aout_ccflags $optimize
12AOUT_AR         = $aout_ar
13AOUT_OBJ_EXT    = $aout_obj_ext
14AOUT_LIB_EXT    = $aout_lib_ext
15AOUT_LIBPERL    = libperl$aout_lib_ext
16AOUT_CLDFLAGS   = $aout_ldflags
17
18AOUT_LIBPERL_DLL        = libperl_dll$aout_lib_ext
19AOUT_CCCMD_DLL  = \$(CC) -DDOSISH -DOS2=2 -DEMBED -I. -DPACK_MALLOC -DDEBUGGING_MSTATS -DTWO_POT_OPTIMIZE -DPERL_EMERGENCY_SBRK
20AOUT_CLDFLAGS_DLL       = -Zexe -Zmt -Zcrtdll
21
22LD_OPT          = $optimize
23
24!GROK!THIS!
25
26$spitshell >>Makefile <<'!NO!SUBS!'
27$(LIBPERL): perl.imp perl.dll perl5.def
28        emximp -o $(LIBPERL) perl.imp
29
30$(AOUT_LIBPERL_DLL): perl.imp perl.dll perl5.def
31        emximp -o $(AOUT_LIBPERL_DLL) perl.imp
32
33perl.imp: perl5.def
34        emximp -o perl.imp perl5.def
35        echo    'emx_calloc             emxlibcm        400     ?' >> $@
36        echo    'emx_free               emxlibcm        401     ?' >> $@
37        echo    'emx_malloc             emxlibcm        402     ?' >> $@
38        echo    'emx_realloc            emxlibcm        403     ?' >> $@
39
40perl.dll: $(obj) perl5.def perl$(OBJ_EXT)
41        $(LD) $(LD_OPT) $(LDDLFLAGS) -o $@ perl$(OBJ_EXT) $(obj) $(libs) perl5.def
42
43perl5.def: perl.linkexp
44        echo "LIBRARY 'Perl' INITINSTANCE TERMINSTANCE" > $@
45        echo DESCRIPTION "'Perl interpreter, export autogenerated'"     >>$@
46        echo STACKSIZE 32768                            >>$@
47        echo CODE LOADONCALL                            >>$@
48        echo DATA LOADONCALL NONSHARED MULTIPLE         >>$@
49        echo EXPORTS                                    >>$@
50        echo '  "ctermid"'                              >>$@
51        echo '  "get_sysinfo"'                          >>$@
52        echo '  "Perl_OS2_init"'                        >>$@
53        echo '  "OS2_Perl_data"'                        >>$@
54        echo '  "dlopen"'                               >>$@
55        echo '  "dlsym"'                                >>$@
56        echo '  "dlerror"'                              >>$@
57        echo '  "my_tmpfile"'                           >>$@
58        echo '  "my_tmpnam"'                            >>$@
59        echo '  "my_flock"'                             >>$@
60!NO!SUBS!
61
62if [ ! -z "$myttyname" ] ; then
63  $spitshell >>Makefile <<'!NO!SUBS!'
64        echo '  "ttyname"'                              >>$@
65!NO!SUBS!
66fi
67
68$spitshell >>Makefile <<'!NO!SUBS!'
69        cat perl.linkexp        >>$@
70
71#       grep -v '"\(malloc\|realloc\|free\)"' perl.linkexp      >>$@
72
73
74perl.exports: perl.exp EXTERN.h perl.h
75        (echo "#include \"EXTERN.h\" \n#include \"perl.h\" \n#include \"perl.exp\"";    \
76         echo "malloc\nrealloc\ncalloc\nfree") | \
77                $(CC) -DEMBED  -E - | \
78                awk '{if ($$2 == "") print $$1}' | sort | uniq > $@
79
80perl.linkexp: perl.exports perl.map
81        cat perl.exports perl.map | sort | uniq -d | sed -e 's/\w\+/  "\0"/' > perl.linkexp
82
83# We link miniperl statically, since .DLL depends on $(DYNALOADER)
84
85perl.map miniperl: $(obj) perl$(OBJ_EXT) miniperlmain$(OBJ_EXT)
86        $(CC) $(LARGE) $(CLDFLAGS) -o miniperl miniperlmain$(OBJ_EXT) perl$(OBJ_EXT) $(obj) $(libs) -Zmap -Zlinker /map
87        awk '{if ($$3 == "") print $$2}' <miniperl.map | sort | uniq > perl.map
88        rm miniperl.map
89        @./miniperl -w -Ilib -MExporter -e 0 || $(MAKE) minitest
90
91depend: os2ish.h dlfcn.h
92
93# Stupid make? Needed...
94os2$(OBJ_EXT) : os2.c
95
96os2.c: os2/os2.c os2ish.h
97        cp $< $@
98
99dl_os2.c: os2/dl_os2.c os2ish.h
100        cp $< $@
101
102os2ish.h: os2/os2ish.h
103        cp $< $@
104
105dlfcn.h: os2/dlfcn.h
106        cp $< $@
107
108# This one is compiled OMF, so cannot fork():
109
110perl___: $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs
111        $(SHRPENV) $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o perl___ perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LIBPERL) `cat ext.libs` $(libs)
112
113installcmd :
114        perl -e 'die qq{Give the option INSTALLCMDDIR=... to make!} if $$ARGV[0] eq ""' $(INSTALLCMDDIR)
115        perl os2/perl2cmd.pl $(INSTALLCMDDIR)
116
117# Aout section:
118
119aout_obj = $(addsuffix $(AOUT_OBJ_EXT),$(basename $(obj)))
120AOUT_DYNALOADER = $(addsuffix $(AOUT_LIB_EXT),$(basename $(DYNALOADER)))
121aout_static_ext = $(addsuffix $(AOUT_LIB_EXT),$(basename $(dynamic_ext)))
122aout_static_lib = $(addsuffix $(LIB_EXT),$(basename $(dynamic_ext)))
123
124aout_static_ext_dll = $(addsuffix $(AOUT_LIB_EXT),$(basename $(static_ext)))
125DYNALOADER_OBJ = ext/DynaLoader/DynaLoader$(OBJ_EXT)
126aout_static_ext_dll = $(addsuffix $(AOUT_LIB_EXT),$(basename $(static_ext)))
127AOUT_DYNALOADER_OBJ = $(addsuffix $(AOUT_OBJ_EXT),$(basename $(DYNALOADER_OBJ)))
128
129$(AOUT_DYNALOADER_OBJ) : $(DYNALOADER_OBJ)
130        emxaout -o $@ $<
131
132$(DYNALOADER_OBJ) : $(DYNALOADER)
133        @sh -c true
134
135$(AOUT_LIBPERL) : $(aout_obj) perl$(AOUT_OBJ_EXT)
136        rm -f $@
137        $(AOUT_AR) rcu $@ perl$(AOUT_OBJ_EXT) $(aout_obj)
138
139.c$(AOUT_OBJ_EXT):
140        $(AOUT_CCCMD) $(PLDLFLAGS) -c $*.c
141
142perlmain(AOUT_OBJ_EXT): perlmain.c
143        $(AOUT_CCCMD_DLL) $(PLDLFLAGS) -c perlmain.c
144
145aout_perlmain.c: miniperlmain.c config.sh makefile $(static_ext_autoinit)
146        sh writemain $(DYNALOADER) $(aout_static_lib) > tmp
147        sh mv-if-diff tmp aout_perlmain.c
148
149miniperl_: $& miniperlmain$(AOUT_OBJ_EXT) $(AOUT_LIBPERL) ext.libs
150        $(CC) $(LARGE) $(AOUT_CLDFLAGS) $(CCDLFLAGS) -o miniperl_ miniperlmain$(AOUT_OBJ_EXT) $(AOUT_LIBPERL) `cat ext.libs` $(libs)
151
152perl_: $& aout_perlmain$(AOUT_OBJ_EXT) $(AOUT_LIBPERL) $(AOUT_DYNALOADER) $(aout_static_ext) ext.libs
153        $(CC) $(LARGE) $(AOUT_CLDFLAGS) $(CCDLFLAGS) -o perl_ aout_perlmain$(AOUT_OBJ_EXT) $(AOUT_DYNALOADER) $(aout_static_ext) $(AOUT_LIBPERL) `cat ext.libs` $(libs)
154
155perl : perl__ perl___
156
157perl__: $& perlmain$(OBJ_EXT) $(LIBPERL) $(DYNALOADER) $(static_ext) ext.libs
158        $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o perl__ perlmain$(OBJ_EXT) $(DYNALOADER) $(static_ext) $(LIBPERL) `cat ext.libs` $(libs) -Zlinker /PM:PM
159
160# Forking dynamically loaded perl:
161
162perl: $& perlmain$(AOUT_OBJ_EXT) $(AOUT_DYNALOADER_OBJ) $(aout_static_ext_dll) $(AOUT_LIBPERL_DLL) ext.libs
163        $(CC) $(LARGE) $(AOUT_CLDFLAGS_DLL) $(CCDLFLAGS) -o perl perlmain$(AOUT_OBJ_EXT) $(AOUT_DYNALOADER_OBJ) $(aout_static_ext_dll) $(AOUT_LIBPERL_DLL) `cat ext.libs` $(libs)
164
165clean: aout_clean
166
167aout_clean:
168        -rm *perl_.* *.o *.a lib/auto/*/*.a ext/*/Makefile.aout
169
170aout_install: perl_ aout_install.perl
171
172aout_install.perl: perl_ installperl
173        ./perl_ installperl
174
175aout_test: perl_
176        - cd t && (rm -f perl_$(EXE_EXT); $(LNS) ../perl_$(EXE_EXT) perl$(EXE_EXT)) && ./perl TEST </dev/tty
177
178lib/auto/OS2/*/%.a : ext/OS2/%/Makefile.aout
179        cd ext/OS2/$(basename $(notdir $@)) ; make -f Makefile.aout config || echo "$make config failed, continuing anyway..."
180        cd ext/OS2/$(basename $(notdir $@)) ; make -f Makefile.aout LINKTYPE=static CCCDLFLAGS=
181
182lib/auto/*/%.a : ext/%/Makefile.aout
183        cd ext/$(basename $(notdir $@)) ; make -f Makefile.aout config || echo "$make config failed, continuing anyway..."
184        cd ext/$(basename $(notdir $@)) ; make -f Makefile.aout LINKTYPE=static CCCDLFLAGS=
185
186.PRECIOUS : ext/%/Makefile.aout ext/OS2/%/Makefile.aout
187
188ext/OS2/%/Makefile.aout : miniperl_
189        cd $(dir $@) ; ../../../miniperl_ -I ../../../lib Makefile.PL MAKEFILE=Makefile.aout INSTALLDIRS=perl
190
191ext/%/Makefile.aout : miniperl_
192        cd $(dir $@) ; ../../miniperl_ -I ../../lib Makefile.PL MAKEFILE=Makefile.aout INSTALLDIRS=perl
193
194!NO!SUBS!
Note: See TracBrowser for help on using the repository browser.