blob: 9487980683a20f61fdb734fa12416c00accc63a1 [file] [log] [blame]
Guido van Rossumb6775db1994-08-01 11:34:53 +00001# META-NOTE: this note is different from the note in the other Makefiles!
2# NOTE: Makefile.pre.in is converted into Makefile.pre by the configure
3# script in the toplevel directory or by ../config.status.
4# Makefile.pre is converted into Makefile by running the makesetup
5# script in the source directory. Once Makefile exists, it can be
6# brought up to date by running "make Makefile". (The makesetup also
7# creates config.c from config.c.in in the source directory.)
Guido van Rossumfba715a1994-01-02 00:26:09 +00008
Guido van Rossumb6775db1994-08-01 11:34:53 +00009# === Variables set by makesetup ===
Guido van Rossumfba715a1994-01-02 00:26:09 +000010
Guido van Rossum3bbc62e1995-01-02 19:30:30 +000011MODOBJS= _MODOBJS_
12MODLIBS= _MODLIBS_
Guido van Rossumfba715a1994-01-02 00:26:09 +000013
Guido van Rossumb6775db1994-08-01 11:34:53 +000014# === Variables set by configure ===
Guido van Rossumfba715a1994-01-02 00:26:09 +000015
Guido van Rossumf6ca6aa1997-07-19 19:39:57 +000016VERSION= @VERSION@
Guido van Rossumfba715a1994-01-02 00:26:09 +000017srcdir= @srcdir@
18VPATH= @srcdir@
19
Guido van Rossum4e083791999-12-16 17:52:08 +000020@SET_CXX@
Guido van Rossumfba715a1994-01-02 00:26:09 +000021CC= @CC@
22RANLIB= @RANLIB@
Guido van Rossumb6775db1994-08-01 11:34:53 +000023AR= @AR@
24
Guido van Rossumf4449de1995-04-10 11:37:18 +000025OPT= @OPT@
Guido van Rossum07b983d1996-08-19 21:59:32 +000026LDFLAGS= @LDFLAGS@
Guido van Rossumbd5f1931997-01-28 02:21:24 +000027LDLAST= @LDLAST@
Guido van Rossum91922671997-10-09 20:24:13 +000028SGI_ABI= @SGI_ABI@
Guido van Rossumf4449de1995-04-10 11:37:18 +000029
Guido van Rossumfba715a1994-01-02 00:26:09 +000030DEFS= @DEFS@
31LIBS= @LIBS@
Guido van Rossumb6775db1994-08-01 11:34:53 +000032LIBM= @LIBM@
33LIBC= @LIBC@
34
Guido van Rossum45a91041995-08-08 14:18:12 +000035# Machine-dependent subdirectories
36MACHDEP= @MACHDEP@
37
Guido van Rossum3bbc62e1995-01-02 19:30:30 +000038# Install prefix for architecture-independent files
39prefix= @prefix@
40
41# Install prefix for architecture-dependent files
42exec_prefix= @exec_prefix@
Guido van Rossumfba715a1994-01-02 00:26:09 +000043
Guido van Rossumff555e32000-09-22 15:38:21 +000044# Executable suffix (.exe on Windows and Mac OS X)
45EXE= @EXE@
46
Guido van Rossum276de581996-07-31 17:37:07 +000047# Expanded directories
48BINDIR= $(exec_prefix)/bin
49LIBDIR= $(exec_prefix)/lib
50MANDIR= $(prefix)/man
51INCLUDEDIR= $(prefix)/include
52SCRIPTDIR= $(prefix)/lib
53
54# Detailed destination directories
55BINLIBDEST= $(LIBDIR)/python$(VERSION)
56LIBDEST= $(SCRIPTDIR)/python$(VERSION)
57INCLUDEPY= $(INCLUDEDIR)/python$(VERSION)
58LIBP= $(LIBDIR)/python$(VERSION)
59
Guido van Rossum7cc5abd1994-09-12 10:42:20 +000060# Symbols used for using shared libraries
61SO= @SO@
62LDSHARED= @LDSHARED@
63CCSHARED= @CCSHARED@
64LINKFORSHARED= @LINKFORSHARED@
Guido van Rossum266033e1997-10-20 23:20:32 +000065DESTSHARED= $(BINLIBDEST)/lib-dynload
Guido van Rossum7cc5abd1994-09-12 10:42:20 +000066
Guido van Rossumddcb36b1996-05-24 21:14:44 +000067# Portable install script (configure doesn't always guess right)
68INSTALL= @srcdir@/../install-sh -c
Guido van Rossum704fef21996-07-30 16:53:14 +000069INSTALL_PROGRAM=${INSTALL} -m 755
Guido van Rossumddcb36b1996-05-24 21:14:44 +000070INSTALL_DATA= ${INSTALL} -m 644
Guido van Rossumcde317a1996-08-20 19:46:35 +000071# Shared libraries must be installed with executable mode on some systems;
72# rather than figuring out exactly which, we always give them executable mode.
Guido van Rossum6fe01d41996-09-11 23:13:07 +000073# Also, making them read-only seems to be a good idea...
74INSTALL_SHARED= ${INSTALL} -m 555
Guido van Rossumddcb36b1996-05-24 21:14:44 +000075
Guido van Rossum275fbe21995-09-30 17:01:49 +000076# === Variables that are customizable by hand or by inclusion in Setup ===
Guido van Rossumfba715a1994-01-02 00:26:09 +000077
Guido van Rossum25f93031997-08-18 16:00:04 +000078LINKCC= @LINKCC@
Guido van Rossumb6775db1994-08-01 11:34:53 +000079INCLDIR= $(srcdir)/../Include
Guido van Rossum450b9b31996-07-21 02:35:58 +000080CONFIGINCLDIR= ..
81CFLAGS= $(OPT) -I$(INCLDIR) -I$(CONFIGINCLDIR) $(DEFS)
Guido van Rossumfba715a1994-01-02 00:26:09 +000082
Guido van Rossumfba715a1994-01-02 00:26:09 +000083MKDEP= mkdep
84SHELL= /bin/sh
85
Guido van Rossumb6775db1994-08-01 11:34:53 +000086MAKESETUP= $(srcdir)/makesetup
Guido van Rossumfba715a1994-01-02 00:26:09 +000087
Guido van Rossumbcc20741998-08-04 22:53:56 +000088# (The makesetup script inserts all variable definitions
Guido van Rossum275fbe21995-09-30 17:01:49 +000089# found in the Setup file just below the following line.
90# This means that the Setup file can override any of the definitions
91# given before this point, but not any given below.
92# The script insert the definitions in reverse order,
93# for the benefits of independent extensions.)
94# === Definitions added by makesetup ===
95
Guido van Rossumfba715a1994-01-02 00:26:09 +000096# === Fixed definitions ===
97
Guido van Rossumf6ca6aa1997-07-19 19:39:57 +000098FIXOBJS= config.o getpath.o main.o getbuildinfo.o
99OBJS= $(MODOBJS) $(FIXOBJS)
Guido van Rossumfba715a1994-01-02 00:26:09 +0000100
Guido van Rossum4e083791999-12-16 17:52:08 +0000101#MAINOBJ= python.o
102MAINOBJ= @MAINOBJ@
Guido van Rossumfba715a1994-01-02 00:26:09 +0000103
Guido van Rossumb6775db1994-08-01 11:34:53 +0000104SYSLIBS= $(LIBM) $(LIBC)
Guido van Rossumfba715a1994-01-02 00:26:09 +0000105
Guido van Rossumf6ca6aa1997-07-19 19:39:57 +0000106LIBRARY= ../libpython$(VERSION).a
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000107LDLIBRARY= ../@LDLIBRARY@
Guido van Rossumb9619202001-01-10 21:12:18 +0000108@SET_DLLLIBRARY@
Guido van Rossumfba715a1994-01-02 00:26:09 +0000109
110# === Rules ===
111
Guido van Rossum79fa8b01997-08-18 14:23:13 +0000112all: $(OBJS)
Guido van Rossumfba715a1994-01-02 00:26:09 +0000113
Guido van Rossumf6ca6aa1997-07-19 19:39:57 +0000114# This target is used by the master Makefile to add the objects to the library.
Guido van Rossum4f46fc61997-08-20 22:45:52 +0000115# To deal with the conflict between signalmodule.o and
116# sigcheck.o+intrcheck.o, we remove the latter two if we have the former.
Guido van Rossum5ec8e4b1997-07-25 22:35:24 +0000117add2lib: $(OBJS)
Guido van Rossum2a570041998-10-07 22:51:56 +0000118 -if test -f hassignal; \
119 then echo removing sigcheck.o intrcheck.o; \
120 $(AR) d $(LIBRARY) sigcheck.o intrcheck.o 2>/dev/null; \
121 else echo leaving sigcheck.o intrcheck.o in; fi
Guido van Rossumf6ca6aa1997-07-19 19:39:57 +0000122 $(AR) cr $(LIBRARY) $(OBJS)
Guido van Rossumf6ca6aa1997-07-19 19:39:57 +0000123 touch add2lib
124
125# This target is used by the master Makefile to link the final binary.
126link: $(MAINOBJ)
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000127 $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) $(MAINOBJ) \
Guido van Rossumff555e32000-09-22 15:38:21 +0000128 $(LDLIBRARY) $(MODLIBS) $(LIBS) $(SYSLIBS) -o python$(EXE) $(LDLAST)
Guido van Rossumd14c0681997-08-22 20:53:47 +0000129 mv python$(EXE) ../python$(EXE)
Guido van Rossumfba715a1994-01-02 00:26:09 +0000130
Guido van Rossumb9619202001-01-10 21:12:18 +0000131# This rule builds the Cygwin Python DLL
132$(DLLLIBRARY): $(LIBRARY)
133 test -d cygwin || mkdir cygwin
134 (cd cygwin; ar x ../$^)
135 dlltool --export-all --output-def $(basename $@).def cygwin/*.o
136 $(LDSHARED) -Wl,--out-implib=$(LDLIBRARY) -o $@ $(basename $@).def cygwin/*.o $(MODLIBS) $(LIBS) $(SYSLIBS)
137 rm -fr cygwin
138
Guido van Rossumfba715a1994-01-02 00:26:09 +0000139clean:
Guido van Rossumd4b8b091999-04-12 16:42:13 +0000140 -rm -f *.o python$(EXE) core *~ [@,#]* *.old *.orig *.rej
141 -rm -f add2lib hassignal
Guido van Rossumfba715a1994-01-02 00:26:09 +0000142
143clobber: clean
Guido van Rossum02759c01998-05-14 02:33:57 +0000144 -rm -f *.a tags TAGS config.c Makefile.pre
Guido van Rossum65544191996-08-08 19:07:46 +0000145 -rm -f *.so *.sl so_locations
Guido van Rossumfba715a1994-01-02 00:26:09 +0000146
Guido van Rossum37ba0bc1995-08-04 04:20:45 +0000147getpath.o: getpath.c Makefile
148 $(CC) -c $(CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
Guido van Rossumc34c9a51996-06-12 04:20:27 +0000149 -DPREFIX='"$(prefix)"' \
150 -DEXEC_PREFIX='"$(exec_prefix)"' \
Guido van Rossumec61b771997-04-11 17:04:49 +0000151 -DVERSION='"$(VERSION)"' \
152 -DVPATH='"$(VPATH)"' \
Guido van Rossum37ba0bc1995-08-04 04:20:45 +0000153 $(srcdir)/getpath.c
154
Guido van Rossumf6ca6aa1997-07-19 19:39:57 +0000155# When the configuration changes, we remove the library, so that it
156# gets remade from scratch; this ensures to remove modules that are no
157# longer pertinent (but that were in a previous configuration).
Guido van Rossuma0cbb3d1997-12-04 00:48:27 +0000158config.c Makefile: Makefile.pre config.c.in $(MAKESETUP)
Barry Warsaw6de72132000-06-30 16:04:18 +0000159config.c Makefile: Setup.config Setup Setup.local
Guido van Rossuma0cbb3d1997-12-04 00:48:27 +0000160config.c Makefile:
Fred Drake9e2e1e52000-10-09 16:48:09 +0000161 -rm -rf $(LIBRARY)
Barry Warsaw6de72132000-06-30 16:04:18 +0000162 $(SHELL) $(MAKESETUP) Setup.config Setup.local Setup
Guido van Rossumfba715a1994-01-02 00:26:09 +0000163
Guido van Rossum2a570041998-10-07 22:51:56 +0000164hassignal:
165 -rm -f hassignal
166 -for i in $(OBJS); do \
167 if test "$$i" = "signalmodule.o"; then \
168 echo yes >hassignal; break; \
169 fi; \
170 done
171
Fred Drakecf3bc8c2000-10-26 17:07:40 +0000172Setup: $(srcdir)/Setup.dist
Fred Drake5f739be2000-10-29 04:28:48 +0000173 @echo "-----------------------------------------------"; \
Fred Drakecf3bc8c2000-10-26 17:07:40 +0000174 echo "Modules/Setup.dist is newer than Modules/Setup;"; \
175 echo "check to make sure you have all the updates you"; \
176 echo "need in your Modules/Setup file."; \
177 echo "-----------------------------------------------";
Fred Drakea54436f2000-08-31 16:56:15 +0000178
Guido van Rossumb6775db1994-08-01 11:34:53 +0000179
Guido van Rossum6fe01d41996-09-11 23:13:07 +0000180Setup.local:
181 echo "# Edit this file for local setup changes" >Setup.local
182
Guido van Rossumb6775db1994-08-01 11:34:53 +0000183Makefile.pre: Makefile.pre.in ../config.status
184 (cd ..; CONFIG_FILES=Modules/Makefile.pre CONFIG_HEADERS= \
185 $(SHELL) config.status)
Guido van Rossumfba715a1994-01-02 00:26:09 +0000186
187depend:
Guido van Rossumb6775db1994-08-01 11:34:53 +0000188 $(MKDEP) $(CFLAGS) `echo $(OBJS) | tr ' ' '\012' | \
189 sed 's|\(.*\)\.o|$(srcdir)/\1.c|'`
Guido van Rossumfba715a1994-01-02 00:26:09 +0000190
Guido van Rossum8ad22c81999-03-23 19:00:55 +0000191.PRECIOUS: ../python$(EXE)
Guido van Rossumfba715a1994-01-02 00:26:09 +0000192
Guido van Rossumb6775db1994-08-01 11:34:53 +0000193glmodule.c: $(srcdir)/cgen.py $(srcdir)/cstubs
194 python $(srcdir)/cgen.py <$(srcdir)/cstubs >glmodule.c
Guido van Rossumfba715a1994-01-02 00:26:09 +0000195
Guido van Rossumb6775db1994-08-01 11:34:53 +0000196almodule.o: almodule.c
197arraymodule.o: arraymodule.c
Guido van Rossumc65a5251994-08-05 13:44:50 +0000198audioop.o: audioop.c
Guido van Rossumb6775db1994-08-01 11:34:53 +0000199cdmodule.o: cdmodule.c
Guido van Rossum4f1099f1997-04-29 15:41:53 +0000200cgensupport.o: cgensupport.c
Guido van Rossumb6775db1994-08-01 11:34:53 +0000201clmodule.o: clmodule.c
Guido van Rossume141fd82000-03-10 23:12:33 +0000202_codecsmodule.o: _codecsmodule.c
Guido van Rossumb6775db1994-08-01 11:34:53 +0000203dbmmodule.o: dbmmodule.c
Guido van Rossum02530b01996-07-31 22:43:38 +0000204errnomodule.o: errnomodule.c
Guido van Rossumb6775db1994-08-01 11:34:53 +0000205fcntlmodule.o: fcntlmodule.c
206flmodule.o: flmodule.c
207fmmodule.o: fmmodule.c
208glmodule.o: glmodule.c
Guido van Rossumc65a5251994-08-05 13:44:50 +0000209imageop.o: imageop.c
210imgfile.o: imgfile.c
Guido van Rossum37ba0bc1995-08-04 04:20:45 +0000211main.o: main.c
Guido van Rossumb6775db1994-08-01 11:34:53 +0000212mathmodule.o: mathmodule.c
213md5c.o: md5c.c
214md5module.o: md5module.c
215mpzmodule.o: mpzmodule.c
216nismodule.o: nismodule.c
Guido van Rossum02530b01996-07-31 22:43:38 +0000217operator.o: operator.c
Guido van Rossumb6775db1994-08-01 11:34:53 +0000218parsermodule.o: parsermodule.c
219posixmodule.o: posixmodule.c
220pwdmodule.o: pwdmodule.c
221regexmodule.o: regexmodule.c
222regexpr.o: regexpr.c
Guido van Rossum2e631391996-12-18 18:37:27 +0000223resource.o: resource.c
Guido van Rossumb6775db1994-08-01 11:34:53 +0000224rgbimgmodule.o: rgbimgmodule.c
225rotormodule.o: rotormodule.c
226selectmodule.o: selectmodule.c
227sgimodule.o: sgimodule.c
228socketmodule.o: socketmodule.c
229stdwinmodule.o: stdwinmodule.c
230stropmodule.o: stropmodule.c
231structmodule.o: structmodule.c
Guido van Rossumc65a5251994-08-05 13:44:50 +0000232sunaudiodev.o: sunaudiodev.c
Guido van Rossumb6775db1994-08-01 11:34:53 +0000233svmodule.o: svmodule.c
234threadmodule.o: threadmodule.c
235timemodule.o: timemodule.c
236timingmodule.o: timingmodule.c
Guido van Rossume141fd82000-03-10 23:12:33 +0000237unicodedata.o: unicodedata.c unicodedatabase.o
Guido van Rossumd7aa0f22000-11-28 12:09:18 +0000238unicodedatabase.o: unicodedatabase.c unicodedatabase.h unicodedata_db.h
Marc-André Lemburgb0c0ecf2000-06-28 16:42:14 +0000239ucnhash.o: ucnhash.c
Guido van Rossumb6775db1994-08-01 11:34:53 +0000240xxmodule.o: xxmodule.c
241yuvconvert.o: yuvconvert.c
242
Guido van Rossum7cc5abd1994-09-12 10:42:20 +0000243# Rules to build and install all shared modules
244sharedmods: $(SHAREDMODS)
Guido van Rossum811fbbc1995-01-22 00:47:59 +0000245sharedinstall: $(DESTSHARED) $(SHAREDMODS)
Guido van Rossumddcb36b1996-05-24 21:14:44 +0000246 -for i in X $(SHAREDMODS); do \
247 if test $$i != X; \
Guido van Rossumcde317a1996-08-20 19:46:35 +0000248 then $(INSTALL_SHARED) $$i $(DESTSHARED)/$$i; \
Guido van Rossumddcb36b1996-05-24 21:14:44 +0000249 fi; \
250 done
Guido van Rossumfba715a1994-01-02 00:26:09 +0000251
Guido van Rossum704fef21996-07-30 16:53:14 +0000252DESTDIRS= $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED)
Guido van Rossum2bd37e61996-06-17 17:33:11 +0000253
Guido van Rossum4daf6ad1996-07-24 02:33:33 +0000254$(DESTSHARED):
255 @for i in $(DESTDIRS); \
256 do \
257 if test ! -d $$i; then \
258 echo "Creating directory $$i"; \
259 mkdir $$i; \
260 chmod 755 $$i; \
261 else true; \
262 fi; \
263 done
Guido van Rossum811fbbc1995-01-22 00:47:59 +0000264
Guido van Rossum4e083791999-12-16 17:52:08 +0000265ccpython.o: ccpython.cc
266 $(CXX) $(CFLAGS) -c $*.cc
267
Guido van Rossum7cc5abd1994-09-12 10:42:20 +0000268# Stuff is appended here by makesetup and make depend