blob: 67c8601f252243ff469956fea7978ba3249225a2 [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 Rossum4daf6ad1996-07-24 02:33:33 +00009# Interpreter version number, for library destination pathnames
Guido van Rossumf631d131997-01-22 03:45:38 +000010VERSION= 1.5
Guido van Rossum4daf6ad1996-07-24 02:33:33 +000011
Guido van Rossumb6775db1994-08-01 11:34:53 +000012# === Variables set by makesetup ===
Guido van Rossumfba715a1994-01-02 00:26:09 +000013
Guido van Rossum3bbc62e1995-01-02 19:30:30 +000014MODOBJS= _MODOBJS_
15MODLIBS= _MODLIBS_
Guido van Rossumfba715a1994-01-02 00:26:09 +000016
Guido van Rossumb6775db1994-08-01 11:34:53 +000017# === Variables set by configure ===
Guido van Rossumfba715a1994-01-02 00:26:09 +000018
19srcdir= @srcdir@
20VPATH= @srcdir@
21
22CC= @CC@
23RANLIB= @RANLIB@
Guido van Rossumb6775db1994-08-01 11:34:53 +000024AR= @AR@
25
Guido van Rossumf4449de1995-04-10 11:37:18 +000026OPT= @OPT@
Guido van Rossum07b983d1996-08-19 21:59:32 +000027LDFLAGS= @LDFLAGS@
Guido van Rossumbd5f1931997-01-28 02:21:24 +000028LDLAST= @LDLAST@
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 Rossum276de581996-07-31 17:37:07 +000044# Expanded directories
45BINDIR= $(exec_prefix)/bin
46LIBDIR= $(exec_prefix)/lib
47MANDIR= $(prefix)/man
48INCLUDEDIR= $(prefix)/include
49SCRIPTDIR= $(prefix)/lib
50
51# Detailed destination directories
52BINLIBDEST= $(LIBDIR)/python$(VERSION)
53LIBDEST= $(SCRIPTDIR)/python$(VERSION)
54INCLUDEPY= $(INCLUDEDIR)/python$(VERSION)
55LIBP= $(LIBDIR)/python$(VERSION)
56
Guido van Rossum7cc5abd1994-09-12 10:42:20 +000057# Symbols used for using shared libraries
58SO= @SO@
59LDSHARED= @LDSHARED@
60CCSHARED= @CCSHARED@
61LINKFORSHARED= @LINKFORSHARED@
Guido van Rossum704fef21996-07-30 16:53:14 +000062DESTSHARED= $(BINLIBDEST)/sharedmodules
Guido van Rossum7cc5abd1994-09-12 10:42:20 +000063
Guido van Rossumddcb36b1996-05-24 21:14:44 +000064# Portable install script (configure doesn't always guess right)
65INSTALL= @srcdir@/../install-sh -c
Guido van Rossum704fef21996-07-30 16:53:14 +000066INSTALL_PROGRAM=${INSTALL} -m 755
Guido van Rossumddcb36b1996-05-24 21:14:44 +000067INSTALL_DATA= ${INSTALL} -m 644
Guido van Rossumcde317a1996-08-20 19:46:35 +000068# Shared libraries must be installed with executable mode on some systems;
69# rather than figuring out exactly which, we always give them executable mode.
Guido van Rossum6fe01d41996-09-11 23:13:07 +000070# Also, making them read-only seems to be a good idea...
71INSTALL_SHARED= ${INSTALL} -m 555
Guido van Rossumddcb36b1996-05-24 21:14:44 +000072
Guido van Rossum275fbe21995-09-30 17:01:49 +000073# === Variables that are customizable by hand or by inclusion in Setup ===
Guido van Rossumfba715a1994-01-02 00:26:09 +000074
Guido van Rossumf4449de1995-04-10 11:37:18 +000075LINKCC= $(CC)
Guido van Rossumb6775db1994-08-01 11:34:53 +000076INCLDIR= $(srcdir)/../Include
Guido van Rossum450b9b31996-07-21 02:35:58 +000077CONFIGINCLDIR= ..
78CFLAGS= $(OPT) -I$(INCLDIR) -I$(CONFIGINCLDIR) $(DEFS)
Guido van Rossumfba715a1994-01-02 00:26:09 +000079
Guido van Rossumfba715a1994-01-02 00:26:09 +000080MKDEP= mkdep
81SHELL= /bin/sh
82
Guido van Rossumb6775db1994-08-01 11:34:53 +000083MAKESETUP= $(srcdir)/makesetup
Guido van Rossumfba715a1994-01-02 00:26:09 +000084
Guido van Rossum275fbe21995-09-30 17:01:49 +000085# (The makesetup script inserts all variable definitions found
86# found in the Setup file just below the following line.
87# This means that the Setup file can override any of the definitions
88# given before this point, but not any given below.
89# The script insert the definitions in reverse order,
90# for the benefits of independent extensions.)
91# === Definitions added by makesetup ===
92
Guido van Rossumfba715a1994-01-02 00:26:09 +000093# === Fixed definitions ===
94
95OBJS= $(MODOBJS)
96
Guido van Rossum2fff2e61997-01-20 18:34:26 +000097ADDOBJS= main.o config.o getpath.o getbuildinfo.o
Guido van Rossum37ba0bc1995-08-04 04:20:45 +000098
Guido van Rossumfba715a1994-01-02 00:26:09 +000099LIB= libModules.a
100
101MYLIBS= $(LIB) \
102 ../Python/libPython.a \
103 ../Objects/libObjects.a \
104 ../Parser/libParser.a
105
Guido van Rossumb6775db1994-08-01 11:34:53 +0000106SYSLIBS= $(LIBM) $(LIBC)
Guido van Rossumfba715a1994-01-02 00:26:09 +0000107
108
109# === Rules ===
110
Guido van Rossum2ce15a51994-10-20 21:59:38 +0000111all: $(LIB) ../python sharedmods
Guido van Rossumfba715a1994-01-02 00:26:09 +0000112
Guido van Rossum450b9b31996-07-21 02:35:58 +0000113asharedmodule: $(ASHAREDMODULE)$(SO)
114
115$(ASHAREDMODULE)$(SO): $(ASHAREDMODULESOBS)
Guido van Rossum07b983d1996-08-19 21:59:32 +0000116 $(LDSHARED) $(LDFLAGS) -o $(ASHAREDMODULE)$(SO) $(ASHAREDMODULESOBS) \
Guido van Rossum450b9b31996-07-21 02:35:58 +0000117 $(ASHAREDMODULESEXTRA)
118
Guido van Rossum087579e1995-01-17 16:11:29 +0000119$(LIB): $& $(OBJS) Makefile
Guido van Rossum794b93e1994-08-23 13:51:25 +0000120 -rm -f $(LIB)
Guido van Rossumfba715a1994-01-02 00:26:09 +0000121 $(AR) cr $(LIB) $(OBJS)
122 $(RANLIB) $(LIB)
123
Guido van Rossum2fff2e61997-01-20 18:34:26 +0000124../python: $(MYLIBS) $(ADDOBJS) Makefile buildno
125 expr `cat buildno` + 1 >@buildno
126 mv @buildno buildno
127 $(CC) -c $(CFLAGS) -DBUILD=`cat buildno` $(srcdir)/getbuildinfo.c
128 $(AR) r $(LIB) getbuildinfo.o
Guido van Rossum07b983d1996-08-19 21:59:32 +0000129 $(LINKCC) $(LDFLAGS) $(OPT) $(LINKFORSHARED) $(ADDOBJS) \
Guido van Rossumbd5f1931997-01-28 02:21:24 +0000130 $(MYLIBS) $(MODLIBS) $(LIBS) $(SYSLIBS) -o python $(LDLAST)
Guido van Rossumb6775db1994-08-01 11:34:53 +0000131 mv python ../python
Guido van Rossumfba715a1994-01-02 00:26:09 +0000132
Guido van Rossum2fff2e61997-01-20 18:34:26 +0000133buildno:
134 echo 0 >buildno
135
Guido van Rossumfba715a1994-01-02 00:26:09 +0000136clean:
137 -rm -f *.o python core *~ [@,#]* *.old *.orig *.rej
138
139clobber: clean
Guido van Rossumb6775db1994-08-01 11:34:53 +0000140 -rm -f *.a tags TAGS config.c glmodule.c Makefile.pre
Guido van Rossum65544191996-08-08 19:07:46 +0000141 -rm -f *.so *.sl so_locations
Guido van Rossumfba715a1994-01-02 00:26:09 +0000142
Guido van Rossum37ba0bc1995-08-04 04:20:45 +0000143getpath.o: getpath.c Makefile
144 $(CC) -c $(CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
Guido van Rossumc34c9a51996-06-12 04:20:27 +0000145 -DPREFIX='"$(prefix)"' \
146 -DEXEC_PREFIX='"$(exec_prefix)"' \
Guido van Rossumec61b771997-04-11 17:04:49 +0000147 -DVERSION='"$(VERSION)"' \
148 -DVPATH='"$(VPATH)"' \
Guido van Rossum37ba0bc1995-08-04 04:20:45 +0000149 $(srcdir)/getpath.c
150
Guido van Rossum6fe01d41996-09-11 23:13:07 +0000151config.c Makefile: Makefile.pre config.c.in $(MAKESETUP) Setup Setup.local
152 $(SHELL) $(MAKESETUP) Setup Setup.local
Guido van Rossumfba715a1994-01-02 00:26:09 +0000153
Guido van Rossumb6775db1994-08-01 11:34:53 +0000154Setup:
155 cp $(srcdir)/Setup.in Setup
156
Guido van Rossum6fe01d41996-09-11 23:13:07 +0000157Setup.local:
158 echo "# Edit this file for local setup changes" >Setup.local
159
Guido van Rossumb6775db1994-08-01 11:34:53 +0000160Makefile.pre: Makefile.pre.in ../config.status
161 (cd ..; CONFIG_FILES=Modules/Makefile.pre CONFIG_HEADERS= \
162 $(SHELL) config.status)
Guido van Rossumfba715a1994-01-02 00:26:09 +0000163
164depend:
Guido van Rossumb6775db1994-08-01 11:34:53 +0000165 $(MKDEP) $(CFLAGS) `echo $(OBJS) | tr ' ' '\012' | \
166 sed 's|\(.*\)\.o|$(srcdir)/\1.c|'`
Guido van Rossumfba715a1994-01-02 00:26:09 +0000167
Guido van Rossumb6775db1994-08-01 11:34:53 +0000168.PRECIOUS: ../python
Guido van Rossumfba715a1994-01-02 00:26:09 +0000169
Guido van Rossumb6775db1994-08-01 11:34:53 +0000170glmodule.c: $(srcdir)/cgen.py $(srcdir)/cstubs
171 python $(srcdir)/cgen.py <$(srcdir)/cstubs >glmodule.c
Guido van Rossumfba715a1994-01-02 00:26:09 +0000172
Guido van Rossumb6775db1994-08-01 11:34:53 +0000173almodule.o: almodule.c
174arraymodule.o: arraymodule.c
Guido van Rossumc65a5251994-08-05 13:44:50 +0000175audioop.o: audioop.c
Guido van Rossumb6775db1994-08-01 11:34:53 +0000176cdmodule.o: cdmodule.c
177clmodule.o: clmodule.c
178dbmmodule.o: dbmmodule.c
Guido van Rossum02530b01996-07-31 22:43:38 +0000179errnomodule.o: errnomodule.c
Guido van Rossumb6775db1994-08-01 11:34:53 +0000180fcntlmodule.o: fcntlmodule.c
181flmodule.o: flmodule.c
182fmmodule.o: fmmodule.c
183glmodule.o: glmodule.c
Guido van Rossumc65a5251994-08-05 13:44:50 +0000184imageop.o: imageop.c
185imgfile.o: imgfile.c
Guido van Rossum37ba0bc1995-08-04 04:20:45 +0000186main.o: main.c
Guido van Rossumb6775db1994-08-01 11:34:53 +0000187mathmodule.o: mathmodule.c
188md5c.o: md5c.c
189md5module.o: md5module.c
190mpzmodule.o: mpzmodule.c
191nismodule.o: nismodule.c
Guido van Rossum02530b01996-07-31 22:43:38 +0000192operator.o: operator.c
Guido van Rossumb6775db1994-08-01 11:34:53 +0000193parsermodule.o: parsermodule.c
194posixmodule.o: posixmodule.c
195pwdmodule.o: pwdmodule.c
196regexmodule.o: regexmodule.c
197regexpr.o: regexpr.c
Guido van Rossum2e631391996-12-18 18:37:27 +0000198resource.o: resource.c
Guido van Rossumb6775db1994-08-01 11:34:53 +0000199rgbimgmodule.o: rgbimgmodule.c
200rotormodule.o: rotormodule.c
201selectmodule.o: selectmodule.c
202sgimodule.o: sgimodule.c
203socketmodule.o: socketmodule.c
204stdwinmodule.o: stdwinmodule.c
205stropmodule.o: stropmodule.c
206structmodule.o: structmodule.c
Guido van Rossumc65a5251994-08-05 13:44:50 +0000207sunaudiodev.o: sunaudiodev.c
Guido van Rossumb6775db1994-08-01 11:34:53 +0000208svmodule.o: svmodule.c
209threadmodule.o: threadmodule.c
210timemodule.o: timemodule.c
211timingmodule.o: timingmodule.c
212xxmodule.o: xxmodule.c
213yuvconvert.o: yuvconvert.c
214
Guido van Rossum7cc5abd1994-09-12 10:42:20 +0000215# Rules to build and install all shared modules
216sharedmods: $(SHAREDMODS)
Guido van Rossum811fbbc1995-01-22 00:47:59 +0000217sharedinstall: $(DESTSHARED) $(SHAREDMODS)
Guido van Rossumddcb36b1996-05-24 21:14:44 +0000218 -for i in X $(SHAREDMODS); do \
219 if test $$i != X; \
Guido van Rossumcde317a1996-08-20 19:46:35 +0000220 then $(INSTALL_SHARED) $$i $(DESTSHARED)/$$i; \
Guido van Rossumddcb36b1996-05-24 21:14:44 +0000221 fi; \
222 done
Guido van Rossumfba715a1994-01-02 00:26:09 +0000223
Guido van Rossum450b9b31996-07-21 02:35:58 +0000224# Install a shared module from outside of setup
225asharedinstall: $(DESTSHARED) $(ASHAREDMODULE)$(SO)
226 -for i in dummy $(ASHAREDMODULE)$(SO); do \
227 if test -f $$i; then mv $$i $(DESTSHARED)/$$i; fi; done
228
229# This is handy when modules need to know where the destination directory is:
230echodestshared: $(DESTSHARED)
231 echo $(DESTSHARED)
232
Guido van Rossum704fef21996-07-30 16:53:14 +0000233DESTDIRS= $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED)
Guido van Rossum2bd37e61996-06-17 17:33:11 +0000234
Guido van Rossum4daf6ad1996-07-24 02:33:33 +0000235$(DESTSHARED):
236 @for i in $(DESTDIRS); \
237 do \
238 if test ! -d $$i; then \
239 echo "Creating directory $$i"; \
240 mkdir $$i; \
241 chmod 755 $$i; \
242 else true; \
243 fi; \
244 done
Guido van Rossum811fbbc1995-01-22 00:47:59 +0000245
Guido van Rossum7cc5abd1994-09-12 10:42:20 +0000246# Stuff is appended here by makesetup and make depend