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 | |
---|
11 | AOUT_CCCMD = \$(CC) $aout_ccflags $optimize |
---|
12 | AOUT_AR = $aout_ar |
---|
13 | AOUT_OBJ_EXT = $aout_obj_ext |
---|
14 | AOUT_LIB_EXT = $aout_lib_ext |
---|
15 | AOUT_LIBPERL = libperl$aout_lib_ext |
---|
16 | AOUT_CLDFLAGS = $aout_ldflags |
---|
17 | |
---|
18 | AOUT_LIBPERL_DLL = libperl_dll$aout_lib_ext |
---|
19 | AOUT_CCCMD_DLL = \$(CC) -DDOSISH -DOS2=2 -DEMBED -I. -DPACK_MALLOC -DDEBUGGING_MSTATS -DTWO_POT_OPTIMIZE -DPERL_EMERGENCY_SBRK |
---|
20 | AOUT_CLDFLAGS_DLL = -Zexe -Zmt -Zcrtdll |
---|
21 | |
---|
22 | LD_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 | |
---|
33 | perl.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 | |
---|
40 | perl.dll: $(obj) perl5.def perl$(OBJ_EXT) |
---|
41 | $(LD) $(LD_OPT) $(LDDLFLAGS) -o $@ perl$(OBJ_EXT) $(obj) $(libs) perl5.def |
---|
42 | |
---|
43 | perl5.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 | |
---|
62 | if [ ! -z "$myttyname" ] ; then |
---|
63 | $spitshell >>Makefile <<'!NO!SUBS!' |
---|
64 | echo ' "ttyname"' >>$@ |
---|
65 | !NO!SUBS! |
---|
66 | fi |
---|
67 | |
---|
68 | $spitshell >>Makefile <<'!NO!SUBS!' |
---|
69 | cat perl.linkexp >>$@ |
---|
70 | |
---|
71 | # grep -v '"\(malloc\|realloc\|free\)"' perl.linkexp >>$@ |
---|
72 | |
---|
73 | |
---|
74 | perl.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 | |
---|
80 | perl.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 | |
---|
85 | perl.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 | |
---|
91 | depend: os2ish.h dlfcn.h |
---|
92 | |
---|
93 | # Stupid make? Needed... |
---|
94 | os2$(OBJ_EXT) : os2.c |
---|
95 | |
---|
96 | os2.c: os2/os2.c os2ish.h |
---|
97 | cp $< $@ |
---|
98 | |
---|
99 | dl_os2.c: os2/dl_os2.c os2ish.h |
---|
100 | cp $< $@ |
---|
101 | |
---|
102 | os2ish.h: os2/os2ish.h |
---|
103 | cp $< $@ |
---|
104 | |
---|
105 | dlfcn.h: os2/dlfcn.h |
---|
106 | cp $< $@ |
---|
107 | |
---|
108 | # This one is compiled OMF, so cannot fork(): |
---|
109 | |
---|
110 | perl___: $& 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 | |
---|
113 | installcmd : |
---|
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 | |
---|
119 | aout_obj = $(addsuffix $(AOUT_OBJ_EXT),$(basename $(obj))) |
---|
120 | AOUT_DYNALOADER = $(addsuffix $(AOUT_LIB_EXT),$(basename $(DYNALOADER))) |
---|
121 | aout_static_ext = $(addsuffix $(AOUT_LIB_EXT),$(basename $(dynamic_ext))) |
---|
122 | aout_static_lib = $(addsuffix $(LIB_EXT),$(basename $(dynamic_ext))) |
---|
123 | |
---|
124 | aout_static_ext_dll = $(addsuffix $(AOUT_LIB_EXT),$(basename $(static_ext))) |
---|
125 | DYNALOADER_OBJ = ext/DynaLoader/DynaLoader$(OBJ_EXT) |
---|
126 | aout_static_ext_dll = $(addsuffix $(AOUT_LIB_EXT),$(basename $(static_ext))) |
---|
127 | AOUT_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 | |
---|
142 | perlmain(AOUT_OBJ_EXT): perlmain.c |
---|
143 | $(AOUT_CCCMD_DLL) $(PLDLFLAGS) -c perlmain.c |
---|
144 | |
---|
145 | aout_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 | |
---|
149 | miniperl_: $& 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 | |
---|
152 | perl_: $& 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 | |
---|
155 | perl : perl__ perl___ |
---|
156 | |
---|
157 | perl__: $& 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 | |
---|
162 | perl: $& 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 | |
---|
165 | clean: aout_clean |
---|
166 | |
---|
167 | aout_clean: |
---|
168 | -rm *perl_.* *.o *.a lib/auto/*/*.a ext/*/Makefile.aout |
---|
169 | |
---|
170 | aout_install: perl_ aout_install.perl |
---|
171 | |
---|
172 | aout_install.perl: perl_ installperl |
---|
173 | ./perl_ installperl |
---|
174 | |
---|
175 | aout_test: perl_ |
---|
176 | - cd t && (rm -f perl_$(EXE_EXT); $(LNS) ../perl_$(EXE_EXT) perl$(EXE_EXT)) && ./perl TEST </dev/tty |
---|
177 | |
---|
178 | lib/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 | |
---|
182 | lib/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 | |
---|
188 | ext/OS2/%/Makefile.aout : miniperl_ |
---|
189 | cd $(dir $@) ; ../../../miniperl_ -I ../../../lib Makefile.PL MAKEFILE=Makefile.aout INSTALLDIRS=perl |
---|
190 | |
---|
191 | ext/%/Makefile.aout : miniperl_ |
---|
192 | cd $(dir $@) ; ../../miniperl_ -I ../../lib Makefile.PL MAKEFILE=Makefile.aout INSTALLDIRS=perl |
---|
193 | |
---|
194 | !NO!SUBS! |
---|