blob: 4c6b3154545de1c6851673f6569abe593d857df2 [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 Rossumf4449de1995-04-10 11:37:18 +000073LINKCC= $(CC)
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 Rossumf6ca6aa1997-07-19 19:39:57 +0000104all: $(OBJS) sharedmods
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.
116add2lib: $(OBJS) buildno
Guido van Rossum2fff2e61997-01-20 18:34:26 +0000117 expr `cat buildno` + 1 >@buildno
118 mv @buildno buildno
Guido van Rossumf6ca6aa1997-07-19 19:39:57 +0000119 $(CC) -c $(CFLAGS) -DBUILD=`cat buildno` \
120 $(srcdir)/getbuildinfo.c
121 $(AR) cr $(LIBRARY) $(OBJS)
122 -if ar x $(LIBRARY) signalmodule.o 2>/dev/null; \
123 then ar d $(LIBRARY) sigcheck.o 2>/dev/null; true; \
124 else true; fi
125 touch add2lib
126
127# This target is used by the master Makefile to link the final binary.
128link: $(MAINOBJ)
129 $(LINKCC) $(LDFLAGS) $(OPT) $(LINKFORSHARED) $(MAINOBJ) \
130 $(LIBRARY) $(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:
Guido van Rossumf6ca6aa1997-07-19 19:39:57 +0000137 -rm -f *.o python core *~ [@,#]* *.old *.orig *.rej add2lib
Guido van Rossumfba715a1994-01-02 00:26:09 +0000138
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 Rossumf6ca6aa1997-07-19 19:39:57 +0000151# When the configuration changes, we remove the library, so that it
152# gets remade from scratch; this ensures to remove modules that are no
153# longer pertinent (but that were in a previous configuration).
Guido van Rossum6fe01d41996-09-11 23:13:07 +0000154config.c Makefile: Makefile.pre config.c.in $(MAKESETUP) Setup Setup.local
Guido van Rossumf6ca6aa1997-07-19 19:39:57 +0000155 -rm -f $(LIBRARY)
Guido van Rossum6fe01d41996-09-11 23:13:07 +0000156 $(SHELL) $(MAKESETUP) Setup Setup.local
Guido van Rossumfba715a1994-01-02 00:26:09 +0000157
Guido van Rossumb6775db1994-08-01 11:34:53 +0000158Setup:
159 cp $(srcdir)/Setup.in Setup
160
Guido van Rossum6fe01d41996-09-11 23:13:07 +0000161Setup.local:
162 echo "# Edit this file for local setup changes" >Setup.local
163
Guido van Rossumb6775db1994-08-01 11:34:53 +0000164Makefile.pre: Makefile.pre.in ../config.status
165 (cd ..; CONFIG_FILES=Modules/Makefile.pre CONFIG_HEADERS= \
166 $(SHELL) config.status)
Guido van Rossumfba715a1994-01-02 00:26:09 +0000167
168depend:
Guido van Rossumb6775db1994-08-01 11:34:53 +0000169 $(MKDEP) $(CFLAGS) `echo $(OBJS) | tr ' ' '\012' | \
170 sed 's|\(.*\)\.o|$(srcdir)/\1.c|'`
Guido van Rossumfba715a1994-01-02 00:26:09 +0000171
Guido van Rossumb6775db1994-08-01 11:34:53 +0000172.PRECIOUS: ../python
Guido van Rossumfba715a1994-01-02 00:26:09 +0000173
Guido van Rossumb6775db1994-08-01 11:34:53 +0000174glmodule.c: $(srcdir)/cgen.py $(srcdir)/cstubs
175 python $(srcdir)/cgen.py <$(srcdir)/cstubs >glmodule.c
Guido van Rossumfba715a1994-01-02 00:26:09 +0000176
Guido van Rossumb6775db1994-08-01 11:34:53 +0000177almodule.o: almodule.c
178arraymodule.o: arraymodule.c
Guido van Rossumc65a5251994-08-05 13:44:50 +0000179audioop.o: audioop.c
Guido van Rossumb6775db1994-08-01 11:34:53 +0000180cdmodule.o: cdmodule.c
Guido van Rossum4f1099f1997-04-29 15:41:53 +0000181cgensupport.o: cgensupport.c
Guido van Rossumb6775db1994-08-01 11:34:53 +0000182clmodule.o: clmodule.c
183dbmmodule.o: dbmmodule.c
Guido van Rossum02530b01996-07-31 22:43:38 +0000184errnomodule.o: errnomodule.c
Guido van Rossumb6775db1994-08-01 11:34:53 +0000185fcntlmodule.o: fcntlmodule.c
186flmodule.o: flmodule.c
187fmmodule.o: fmmodule.c
188glmodule.o: glmodule.c
Guido van Rossumc65a5251994-08-05 13:44:50 +0000189imageop.o: imageop.c
190imgfile.o: imgfile.c
Guido van Rossum37ba0bc1995-08-04 04:20:45 +0000191main.o: main.c
Guido van Rossumb6775db1994-08-01 11:34:53 +0000192mathmodule.o: mathmodule.c
193md5c.o: md5c.c
194md5module.o: md5module.c
195mpzmodule.o: mpzmodule.c
196nismodule.o: nismodule.c
Guido van Rossum02530b01996-07-31 22:43:38 +0000197operator.o: operator.c
Guido van Rossumb6775db1994-08-01 11:34:53 +0000198parsermodule.o: parsermodule.c
199posixmodule.o: posixmodule.c
200pwdmodule.o: pwdmodule.c
201regexmodule.o: regexmodule.c
202regexpr.o: regexpr.c
Guido van Rossum2e631391996-12-18 18:37:27 +0000203resource.o: resource.c
Guido van Rossumb6775db1994-08-01 11:34:53 +0000204rgbimgmodule.o: rgbimgmodule.c
205rotormodule.o: rotormodule.c
206selectmodule.o: selectmodule.c
207sgimodule.o: sgimodule.c
208socketmodule.o: socketmodule.c
209stdwinmodule.o: stdwinmodule.c
210stropmodule.o: stropmodule.c
211structmodule.o: structmodule.c
Guido van Rossumc65a5251994-08-05 13:44:50 +0000212sunaudiodev.o: sunaudiodev.c
Guido van Rossumb6775db1994-08-01 11:34:53 +0000213svmodule.o: svmodule.c
214threadmodule.o: threadmodule.c
215timemodule.o: timemodule.c
216timingmodule.o: timingmodule.c
217xxmodule.o: xxmodule.c
218yuvconvert.o: yuvconvert.c
219
Guido van Rossum7cc5abd1994-09-12 10:42:20 +0000220# Rules to build and install all shared modules
221sharedmods: $(SHAREDMODS)
Guido van Rossum811fbbc1995-01-22 00:47:59 +0000222sharedinstall: $(DESTSHARED) $(SHAREDMODS)
Guido van Rossumddcb36b1996-05-24 21:14:44 +0000223 -for i in X $(SHAREDMODS); do \
224 if test $$i != X; \
Guido van Rossumcde317a1996-08-20 19:46:35 +0000225 then $(INSTALL_SHARED) $$i $(DESTSHARED)/$$i; \
Guido van Rossumddcb36b1996-05-24 21:14:44 +0000226 fi; \
227 done
Guido van Rossumfba715a1994-01-02 00:26:09 +0000228
Guido van Rossum450b9b31996-07-21 02:35:58 +0000229# Install a shared module from outside of setup
230asharedinstall: $(DESTSHARED) $(ASHAREDMODULE)$(SO)
231 -for i in dummy $(ASHAREDMODULE)$(SO); do \
232 if test -f $$i; then mv $$i $(DESTSHARED)/$$i; fi; done
233
234# This is handy when modules need to know where the destination directory is:
235echodestshared: $(DESTSHARED)
236 echo $(DESTSHARED)
237
Guido van Rossum704fef21996-07-30 16:53:14 +0000238DESTDIRS= $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED)
Guido van Rossum2bd37e61996-06-17 17:33:11 +0000239
Guido van Rossum4daf6ad1996-07-24 02:33:33 +0000240$(DESTSHARED):
241 @for i in $(DESTDIRS); \
242 do \
243 if test ! -d $$i; then \
244 echo "Creating directory $$i"; \
245 mkdir $$i; \
246 chmod 755 $$i; \
247 else true; \
248 fi; \
249 done
Guido van Rossum811fbbc1995-01-22 00:47:59 +0000250
Guido van Rossum7cc5abd1994-09-12 10:42:20 +0000251# Stuff is appended here by makesetup and make depend