blob: 6c5ddb1909303a537640a06e8b1e0b30a6df3c1a [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
20CC= @CC@
21RANLIB= @RANLIB@
Guido van Rossumb6775db1994-08-01 11:34:53 +000022AR= @AR@
23
Guido van Rossumf4449de1995-04-10 11:37:18 +000024OPT= @OPT@
Guido van Rossum07b983d1996-08-19 21:59:32 +000025LDFLAGS= @LDFLAGS@
Guido van Rossumbd5f1931997-01-28 02:21:24 +000026LDLAST= @LDLAST@
Guido van Rossumf4449de1995-04-10 11:37:18 +000027
Guido van Rossumfba715a1994-01-02 00:26:09 +000028DEFS= @DEFS@
29LIBS= @LIBS@
Guido van Rossumb6775db1994-08-01 11:34:53 +000030LIBM= @LIBM@
31LIBC= @LIBC@
32
Guido van Rossum45a91041995-08-08 14:18:12 +000033# Machine-dependent subdirectories
34MACHDEP= @MACHDEP@
35
Guido van Rossum3bbc62e1995-01-02 19:30:30 +000036# Install prefix for architecture-independent files
37prefix= @prefix@
38
39# Install prefix for architecture-dependent files
40exec_prefix= @exec_prefix@
Guido van Rossumfba715a1994-01-02 00:26:09 +000041
Guido van Rossum276de581996-07-31 17:37:07 +000042# Expanded directories
43BINDIR= $(exec_prefix)/bin
44LIBDIR= $(exec_prefix)/lib
45MANDIR= $(prefix)/man
46INCLUDEDIR= $(prefix)/include
47SCRIPTDIR= $(prefix)/lib
48
49# Detailed destination directories
50BINLIBDEST= $(LIBDIR)/python$(VERSION)
51LIBDEST= $(SCRIPTDIR)/python$(VERSION)
52INCLUDEPY= $(INCLUDEDIR)/python$(VERSION)
53LIBP= $(LIBDIR)/python$(VERSION)
54
Guido van Rossum7cc5abd1994-09-12 10:42:20 +000055# Symbols used for using shared libraries
56SO= @SO@
57LDSHARED= @LDSHARED@
58CCSHARED= @CCSHARED@
59LINKFORSHARED= @LINKFORSHARED@
Guido van Rossum704fef21996-07-30 16:53:14 +000060DESTSHARED= $(BINLIBDEST)/sharedmodules
Guido van Rossum7cc5abd1994-09-12 10:42:20 +000061
Guido van Rossumddcb36b1996-05-24 21:14:44 +000062# Portable install script (configure doesn't always guess right)
63INSTALL= @srcdir@/../install-sh -c
Guido van Rossum704fef21996-07-30 16:53:14 +000064INSTALL_PROGRAM=${INSTALL} -m 755
Guido van Rossumddcb36b1996-05-24 21:14:44 +000065INSTALL_DATA= ${INSTALL} -m 644
Guido van Rossumcde317a1996-08-20 19:46:35 +000066# Shared libraries must be installed with executable mode on some systems;
67# rather than figuring out exactly which, we always give them executable mode.
Guido van Rossum6fe01d41996-09-11 23:13:07 +000068# Also, making them read-only seems to be a good idea...
69INSTALL_SHARED= ${INSTALL} -m 555
Guido van Rossumddcb36b1996-05-24 21:14:44 +000070
Guido van Rossum275fbe21995-09-30 17:01:49 +000071# === Variables that are customizable by hand or by inclusion in Setup ===
Guido van Rossumfba715a1994-01-02 00:26:09 +000072
Guido van Rossum25f93031997-08-18 16:00:04 +000073LINKCC= @LINKCC@
Guido van Rossumb6775db1994-08-01 11:34:53 +000074INCLDIR= $(srcdir)/../Include
Guido van Rossum450b9b31996-07-21 02:35:58 +000075CONFIGINCLDIR= ..
76CFLAGS= $(OPT) -I$(INCLDIR) -I$(CONFIGINCLDIR) $(DEFS)
Guido van Rossumfba715a1994-01-02 00:26:09 +000077
Guido van Rossumfba715a1994-01-02 00:26:09 +000078MKDEP= mkdep
79SHELL= /bin/sh
80
Guido van Rossumb6775db1994-08-01 11:34:53 +000081MAKESETUP= $(srcdir)/makesetup
Guido van Rossumfba715a1994-01-02 00:26:09 +000082
Guido van Rossum275fbe21995-09-30 17:01:49 +000083# (The makesetup script inserts all variable definitions found
84# found in the Setup file just below the following line.
85# This means that the Setup file can override any of the definitions
86# given before this point, but not any given below.
87# The script insert the definitions in reverse order,
88# for the benefits of independent extensions.)
89# === Definitions added by makesetup ===
90
Guido van Rossumfba715a1994-01-02 00:26:09 +000091# === Fixed definitions ===
92
Guido van Rossumf6ca6aa1997-07-19 19:39:57 +000093FIXOBJS= config.o getpath.o main.o getbuildinfo.o
94OBJS= $(MODOBJS) $(FIXOBJS)
Guido van Rossumfba715a1994-01-02 00:26:09 +000095
Guido van Rossumf6ca6aa1997-07-19 19:39:57 +000096MAINOBJ= python.o
Guido van Rossumfba715a1994-01-02 00:26:09 +000097
Guido van Rossumb6775db1994-08-01 11:34:53 +000098SYSLIBS= $(LIBM) $(LIBC)
Guido van Rossumfba715a1994-01-02 00:26:09 +000099
Guido van Rossumf6ca6aa1997-07-19 19:39:57 +0000100LIBRARY= ../libpython$(VERSION).a
Guido van Rossumfba715a1994-01-02 00:26:09 +0000101
102# === Rules ===
103
Guido van Rossum79fa8b01997-08-18 14:23:13 +0000104all: $(OBJS)
Guido van Rossumfba715a1994-01-02 00:26:09 +0000105
Guido van Rossumf6ca6aa1997-07-19 19:39:57 +0000106# Targets for Jim Fulton's extension Makefiles -- are these still needed?
Guido van Rossum450b9b31996-07-21 02:35:58 +0000107asharedmodule: $(ASHAREDMODULE)$(SO)
108
109$(ASHAREDMODULE)$(SO): $(ASHAREDMODULESOBS)
Guido van Rossum07b983d1996-08-19 21:59:32 +0000110 $(LDSHARED) $(LDFLAGS) -o $(ASHAREDMODULE)$(SO) $(ASHAREDMODULESOBS) \
Guido van Rossum450b9b31996-07-21 02:35:58 +0000111 $(ASHAREDMODULESEXTRA)
112
Guido van Rossumf6ca6aa1997-07-19 19:39:57 +0000113# This target is used by the master Makefile to add the objects to the library.
114# To deal with the conflict between signalmodule.o and sigcheck.o,
115# we remove the latter if we have the former.
Guido van Rossum5ec8e4b1997-07-25 22:35:24 +0000116add2lib: $(OBJS)
Guido van Rossumf6ca6aa1997-07-19 19:39:57 +0000117 $(AR) cr $(LIBRARY) $(OBJS)
118 -if ar x $(LIBRARY) signalmodule.o 2>/dev/null; \
119 then ar d $(LIBRARY) sigcheck.o 2>/dev/null; true; \
120 else true; fi
121 touch add2lib
122
123# This target is used by the master Makefile to link the final binary.
124link: $(MAINOBJ)
125 $(LINKCC) $(LDFLAGS) $(OPT) $(LINKFORSHARED) $(MAINOBJ) \
126 $(LIBRARY) $(MODLIBS) $(LIBS) $(SYSLIBS) -o python $(LDLAST)
Guido van Rossumb6775db1994-08-01 11:34:53 +0000127 mv python ../python
Guido van Rossumfba715a1994-01-02 00:26:09 +0000128
Guido van Rossumfba715a1994-01-02 00:26:09 +0000129clean:
Guido van Rossumf6ca6aa1997-07-19 19:39:57 +0000130 -rm -f *.o python core *~ [@,#]* *.old *.orig *.rej add2lib
Guido van Rossumfba715a1994-01-02 00:26:09 +0000131
132clobber: clean
Guido van Rossumb6775db1994-08-01 11:34:53 +0000133 -rm -f *.a tags TAGS config.c glmodule.c Makefile.pre
Guido van Rossum65544191996-08-08 19:07:46 +0000134 -rm -f *.so *.sl so_locations
Guido van Rossumfba715a1994-01-02 00:26:09 +0000135
Guido van Rossum37ba0bc1995-08-04 04:20:45 +0000136getpath.o: getpath.c Makefile
137 $(CC) -c $(CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
Guido van Rossumc34c9a51996-06-12 04:20:27 +0000138 -DPREFIX='"$(prefix)"' \
139 -DEXEC_PREFIX='"$(exec_prefix)"' \
Guido van Rossumec61b771997-04-11 17:04:49 +0000140 -DVERSION='"$(VERSION)"' \
141 -DVPATH='"$(VPATH)"' \
Guido van Rossum37ba0bc1995-08-04 04:20:45 +0000142 $(srcdir)/getpath.c
143
Guido van Rossumf6ca6aa1997-07-19 19:39:57 +0000144# When the configuration changes, we remove the library, so that it
145# gets remade from scratch; this ensures to remove modules that are no
146# longer pertinent (but that were in a previous configuration).
Guido van Rossum6fe01d41996-09-11 23:13:07 +0000147config.c Makefile: Makefile.pre config.c.in $(MAKESETUP) Setup Setup.local
Guido van Rossumf6ca6aa1997-07-19 19:39:57 +0000148 -rm -f $(LIBRARY)
Guido van Rossum6fe01d41996-09-11 23:13:07 +0000149 $(SHELL) $(MAKESETUP) Setup Setup.local
Guido van Rossumfba715a1994-01-02 00:26:09 +0000150
Guido van Rossumb6775db1994-08-01 11:34:53 +0000151Setup:
152 cp $(srcdir)/Setup.in Setup
153
Guido van Rossum6fe01d41996-09-11 23:13:07 +0000154Setup.local:
155 echo "# Edit this file for local setup changes" >Setup.local
156
Guido van Rossumb6775db1994-08-01 11:34:53 +0000157Makefile.pre: Makefile.pre.in ../config.status
158 (cd ..; CONFIG_FILES=Modules/Makefile.pre CONFIG_HEADERS= \
159 $(SHELL) config.status)
Guido van Rossumfba715a1994-01-02 00:26:09 +0000160
161depend:
Guido van Rossumb6775db1994-08-01 11:34:53 +0000162 $(MKDEP) $(CFLAGS) `echo $(OBJS) | tr ' ' '\012' | \
163 sed 's|\(.*\)\.o|$(srcdir)/\1.c|'`
Guido van Rossumfba715a1994-01-02 00:26:09 +0000164
Guido van Rossumb6775db1994-08-01 11:34:53 +0000165.PRECIOUS: ../python
Guido van Rossumfba715a1994-01-02 00:26:09 +0000166
Guido van Rossumb6775db1994-08-01 11:34:53 +0000167glmodule.c: $(srcdir)/cgen.py $(srcdir)/cstubs
168 python $(srcdir)/cgen.py <$(srcdir)/cstubs >glmodule.c
Guido van Rossumfba715a1994-01-02 00:26:09 +0000169
Guido van Rossumb6775db1994-08-01 11:34:53 +0000170almodule.o: almodule.c
171arraymodule.o: arraymodule.c
Guido van Rossumc65a5251994-08-05 13:44:50 +0000172audioop.o: audioop.c
Guido van Rossumb6775db1994-08-01 11:34:53 +0000173cdmodule.o: cdmodule.c
Guido van Rossum4f1099f1997-04-29 15:41:53 +0000174cgensupport.o: cgensupport.c
Guido van Rossumb6775db1994-08-01 11:34:53 +0000175clmodule.o: clmodule.c
176dbmmodule.o: dbmmodule.c
Guido van Rossum02530b01996-07-31 22:43:38 +0000177errnomodule.o: errnomodule.c
Guido van Rossumb6775db1994-08-01 11:34:53 +0000178fcntlmodule.o: fcntlmodule.c
179flmodule.o: flmodule.c
180fmmodule.o: fmmodule.c
181glmodule.o: glmodule.c
Guido van Rossumc65a5251994-08-05 13:44:50 +0000182imageop.o: imageop.c
183imgfile.o: imgfile.c
Guido van Rossum37ba0bc1995-08-04 04:20:45 +0000184main.o: main.c
Guido van Rossumb6775db1994-08-01 11:34:53 +0000185mathmodule.o: mathmodule.c
186md5c.o: md5c.c
187md5module.o: md5module.c
188mpzmodule.o: mpzmodule.c
189nismodule.o: nismodule.c
Guido van Rossum02530b01996-07-31 22:43:38 +0000190operator.o: operator.c
Guido van Rossumb6775db1994-08-01 11:34:53 +0000191parsermodule.o: parsermodule.c
192posixmodule.o: posixmodule.c
193pwdmodule.o: pwdmodule.c
194regexmodule.o: regexmodule.c
195regexpr.o: regexpr.c
Guido van Rossum2e631391996-12-18 18:37:27 +0000196resource.o: resource.c
Guido van Rossumb6775db1994-08-01 11:34:53 +0000197rgbimgmodule.o: rgbimgmodule.c
198rotormodule.o: rotormodule.c
199selectmodule.o: selectmodule.c
200sgimodule.o: sgimodule.c
201socketmodule.o: socketmodule.c
202stdwinmodule.o: stdwinmodule.c
203stropmodule.o: stropmodule.c
204structmodule.o: structmodule.c
Guido van Rossumc65a5251994-08-05 13:44:50 +0000205sunaudiodev.o: sunaudiodev.c
Guido van Rossumb6775db1994-08-01 11:34:53 +0000206svmodule.o: svmodule.c
207threadmodule.o: threadmodule.c
208timemodule.o: timemodule.c
209timingmodule.o: timingmodule.c
210xxmodule.o: xxmodule.c
211yuvconvert.o: yuvconvert.c
212
Guido van Rossum7cc5abd1994-09-12 10:42:20 +0000213# Rules to build and install all shared modules
214sharedmods: $(SHAREDMODS)
Guido van Rossum811fbbc1995-01-22 00:47:59 +0000215sharedinstall: $(DESTSHARED) $(SHAREDMODS)
Guido van Rossumddcb36b1996-05-24 21:14:44 +0000216 -for i in X $(SHAREDMODS); do \
217 if test $$i != X; \
Guido van Rossumcde317a1996-08-20 19:46:35 +0000218 then $(INSTALL_SHARED) $$i $(DESTSHARED)/$$i; \
Guido van Rossumddcb36b1996-05-24 21:14:44 +0000219 fi; \
220 done
Guido van Rossumfba715a1994-01-02 00:26:09 +0000221
Guido van Rossum450b9b31996-07-21 02:35:58 +0000222# Install a shared module from outside of setup
223asharedinstall: $(DESTSHARED) $(ASHAREDMODULE)$(SO)
224 -for i in dummy $(ASHAREDMODULE)$(SO); do \
225 if test -f $$i; then mv $$i $(DESTSHARED)/$$i; fi; done
226
227# This is handy when modules need to know where the destination directory is:
228echodestshared: $(DESTSHARED)
229 echo $(DESTSHARED)
230
Guido van Rossum704fef21996-07-30 16:53:14 +0000231DESTDIRS= $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED)
Guido van Rossum2bd37e61996-06-17 17:33:11 +0000232
Guido van Rossum4daf6ad1996-07-24 02:33:33 +0000233$(DESTSHARED):
234 @for i in $(DESTDIRS); \
235 do \
236 if test ! -d $$i; then \
237 echo "Creating directory $$i"; \
238 mkdir $$i; \
239 chmod 755 $$i; \
240 else true; \
241 fi; \
242 done
Guido van Rossum811fbbc1995-01-22 00:47:59 +0000243
Guido van Rossum7cc5abd1994-09-12 10:42:20 +0000244# Stuff is appended here by makesetup and make depend