blob: e62d5ed28bc994bfd64a4531ccc28522badeb332 [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.
Guido van Rossum4f46fc61997-08-20 22:45:52 +0000114# To deal with the conflict between signalmodule.o and
115# sigcheck.o+intrcheck.o, we remove the latter two if we have the former.
Guido van Rossum5ec8e4b1997-07-25 22:35:24 +0000116add2lib: $(OBJS)
Guido van Rossumbae65231997-08-21 02:30:20 +0000117 -for i in $(OBJS); do \
118 if test "$$i" = "signalmodule.o"; then \
119 ar d $(LIBRARY) sigcheck.o intrcheck.o 2>/dev/null; \
120 break; \
121 fi; \
122 done
Guido van Rossumf6ca6aa1997-07-19 19:39:57 +0000123 $(AR) cr $(LIBRARY) $(OBJS)
Guido van Rossumf6ca6aa1997-07-19 19:39:57 +0000124 touch add2lib
125
Guido van Rossumd14c0681997-08-22 20:53:47 +0000126# Use ``EXE=.exe'' for Unix emulations on DOS/Windows
127EXE=
128
Guido van Rossumf6ca6aa1997-07-19 19:39:57 +0000129# This target is used by the master Makefile to link the final binary.
130link: $(MAINOBJ)
131 $(LINKCC) $(LDFLAGS) $(OPT) $(LINKFORSHARED) $(MAINOBJ) \
132 $(LIBRARY) $(MODLIBS) $(LIBS) $(SYSLIBS) -o python $(LDLAST)
Guido van Rossumd14c0681997-08-22 20:53:47 +0000133 mv python$(EXE) ../python$(EXE)
Guido van Rossumfba715a1994-01-02 00:26:09 +0000134
Guido van Rossumfba715a1994-01-02 00:26:09 +0000135clean:
Guido van Rossumf6ca6aa1997-07-19 19:39:57 +0000136 -rm -f *.o python core *~ [@,#]* *.old *.orig *.rej add2lib
Guido van Rossumfba715a1994-01-02 00:26:09 +0000137
138clobber: clean
Guido van Rossumb6775db1994-08-01 11:34:53 +0000139 -rm -f *.a tags TAGS config.c glmodule.c Makefile.pre
Guido van Rossum65544191996-08-08 19:07:46 +0000140 -rm -f *.so *.sl so_locations
Guido van Rossumfba715a1994-01-02 00:26:09 +0000141
Guido van Rossum37ba0bc1995-08-04 04:20:45 +0000142getpath.o: getpath.c Makefile
143 $(CC) -c $(CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
Guido van Rossumc34c9a51996-06-12 04:20:27 +0000144 -DPREFIX='"$(prefix)"' \
145 -DEXEC_PREFIX='"$(exec_prefix)"' \
Guido van Rossumec61b771997-04-11 17:04:49 +0000146 -DVERSION='"$(VERSION)"' \
147 -DVPATH='"$(VPATH)"' \
Guido van Rossum37ba0bc1995-08-04 04:20:45 +0000148 $(srcdir)/getpath.c
149
Guido van Rossumf6ca6aa1997-07-19 19:39:57 +0000150# When the configuration changes, we remove the library, so that it
151# gets remade from scratch; this ensures to remove modules that are no
152# longer pertinent (but that were in a previous configuration).
Guido van Rossum6fe01d41996-09-11 23:13:07 +0000153config.c Makefile: Makefile.pre config.c.in $(MAKESETUP) Setup Setup.local
Guido van Rossumf6ca6aa1997-07-19 19:39:57 +0000154 -rm -f $(LIBRARY)
Guido van Rossum970f5d31997-09-07 16:44:37 +0000155 $(SHELL) $(MAKESETUP) Setup.local Setup
Guido van Rossumfba715a1994-01-02 00:26:09 +0000156
Guido van Rossumb6775db1994-08-01 11:34:53 +0000157Setup:
158 cp $(srcdir)/Setup.in Setup
159
Guido van Rossum6fe01d41996-09-11 23:13:07 +0000160Setup.local:
161 echo "# Edit this file for local setup changes" >Setup.local
162
Guido van Rossumb6775db1994-08-01 11:34:53 +0000163Makefile.pre: Makefile.pre.in ../config.status
164 (cd ..; CONFIG_FILES=Modules/Makefile.pre CONFIG_HEADERS= \
165 $(SHELL) config.status)
Guido van Rossumfba715a1994-01-02 00:26:09 +0000166
167depend:
Guido van Rossumb6775db1994-08-01 11:34:53 +0000168 $(MKDEP) $(CFLAGS) `echo $(OBJS) | tr ' ' '\012' | \
169 sed 's|\(.*\)\.o|$(srcdir)/\1.c|'`
Guido van Rossumfba715a1994-01-02 00:26:09 +0000170
Guido van Rossumb6775db1994-08-01 11:34:53 +0000171.PRECIOUS: ../python
Guido van Rossumfba715a1994-01-02 00:26:09 +0000172
Guido van Rossumb6775db1994-08-01 11:34:53 +0000173glmodule.c: $(srcdir)/cgen.py $(srcdir)/cstubs
174 python $(srcdir)/cgen.py <$(srcdir)/cstubs >glmodule.c
Guido van Rossumfba715a1994-01-02 00:26:09 +0000175
Guido van Rossumb6775db1994-08-01 11:34:53 +0000176almodule.o: almodule.c
177arraymodule.o: arraymodule.c
Guido van Rossumc65a5251994-08-05 13:44:50 +0000178audioop.o: audioop.c
Guido van Rossumb6775db1994-08-01 11:34:53 +0000179cdmodule.o: cdmodule.c
Guido van Rossum4f1099f1997-04-29 15:41:53 +0000180cgensupport.o: cgensupport.c
Guido van Rossumb6775db1994-08-01 11:34:53 +0000181clmodule.o: clmodule.c
182dbmmodule.o: dbmmodule.c
Guido van Rossum02530b01996-07-31 22:43:38 +0000183errnomodule.o: errnomodule.c
Guido van Rossumb6775db1994-08-01 11:34:53 +0000184fcntlmodule.o: fcntlmodule.c
185flmodule.o: flmodule.c
186fmmodule.o: fmmodule.c
187glmodule.o: glmodule.c
Guido van Rossumc65a5251994-08-05 13:44:50 +0000188imageop.o: imageop.c
189imgfile.o: imgfile.c
Guido van Rossum37ba0bc1995-08-04 04:20:45 +0000190main.o: main.c
Guido van Rossumb6775db1994-08-01 11:34:53 +0000191mathmodule.o: mathmodule.c
192md5c.o: md5c.c
193md5module.o: md5module.c
194mpzmodule.o: mpzmodule.c
195nismodule.o: nismodule.c
Guido van Rossum02530b01996-07-31 22:43:38 +0000196operator.o: operator.c
Guido van Rossumb6775db1994-08-01 11:34:53 +0000197parsermodule.o: parsermodule.c
198posixmodule.o: posixmodule.c
199pwdmodule.o: pwdmodule.c
200regexmodule.o: regexmodule.c
201regexpr.o: regexpr.c
Guido van Rossum2e631391996-12-18 18:37:27 +0000202resource.o: resource.c
Guido van Rossumb6775db1994-08-01 11:34:53 +0000203rgbimgmodule.o: rgbimgmodule.c
204rotormodule.o: rotormodule.c
205selectmodule.o: selectmodule.c
206sgimodule.o: sgimodule.c
207socketmodule.o: socketmodule.c
208stdwinmodule.o: stdwinmodule.c
209stropmodule.o: stropmodule.c
210structmodule.o: structmodule.c
Guido van Rossumc65a5251994-08-05 13:44:50 +0000211sunaudiodev.o: sunaudiodev.c
Guido van Rossumb6775db1994-08-01 11:34:53 +0000212svmodule.o: svmodule.c
213threadmodule.o: threadmodule.c
214timemodule.o: timemodule.c
215timingmodule.o: timingmodule.c
216xxmodule.o: xxmodule.c
217yuvconvert.o: yuvconvert.c
218
Guido van Rossum7cc5abd1994-09-12 10:42:20 +0000219# Rules to build and install all shared modules
220sharedmods: $(SHAREDMODS)
Guido van Rossum811fbbc1995-01-22 00:47:59 +0000221sharedinstall: $(DESTSHARED) $(SHAREDMODS)
Guido van Rossumddcb36b1996-05-24 21:14:44 +0000222 -for i in X $(SHAREDMODS); do \
223 if test $$i != X; \
Guido van Rossumcde317a1996-08-20 19:46:35 +0000224 then $(INSTALL_SHARED) $$i $(DESTSHARED)/$$i; \
Guido van Rossumddcb36b1996-05-24 21:14:44 +0000225 fi; \
226 done
Guido van Rossumfba715a1994-01-02 00:26:09 +0000227
Guido van Rossum450b9b31996-07-21 02:35:58 +0000228# Install a shared module from outside of setup
229asharedinstall: $(DESTSHARED) $(ASHAREDMODULE)$(SO)
230 -for i in dummy $(ASHAREDMODULE)$(SO); do \
231 if test -f $$i; then mv $$i $(DESTSHARED)/$$i; fi; done
232
233# This is handy when modules need to know where the destination directory is:
234echodestshared: $(DESTSHARED)
235 echo $(DESTSHARED)
236
Guido van Rossum704fef21996-07-30 16:53:14 +0000237DESTDIRS= $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED)
Guido van Rossum2bd37e61996-06-17 17:33:11 +0000238
Guido van Rossum4daf6ad1996-07-24 02:33:33 +0000239$(DESTSHARED):
240 @for i in $(DESTDIRS); \
241 do \
242 if test ! -d $$i; then \
243 echo "Creating directory $$i"; \
244 mkdir $$i; \
245 chmod 755 $$i; \
246 else true; \
247 fi; \
248 done
Guido van Rossum811fbbc1995-01-22 00:47:59 +0000249
Guido van Rossum7cc5abd1994-09-12 10:42:20 +0000250# Stuff is appended here by makesetup and make depend