Makefile.pre.in 6.38 KB
Newer Older
1 2 3 4 5 6 7
# META-NOTE: this note is different from the note in the other Makefiles!
# NOTE: Makefile.pre.in is converted into Makefile.pre by the configure
# script in the toplevel directory or by ../config.status.
# Makefile.pre is converted into Makefile by running the makesetup
# script in the source directory.  Once Makefile exists, it can be
# brought up to date by running "make Makefile".  (The makesetup also
# creates config.c from config.c.in in the source directory.)
8

9
# === Variables set by makesetup ===
10

11 12
MODOBJS=	_MODOBJS_
MODLIBS=	_MODLIBS_
13

14
# === Variables set by configure ===
15

Guido van Rossum's avatar
Guido van Rossum committed
16
VERSION=	@VERSION@
17 18 19
srcdir=		@srcdir@
VPATH=		@srcdir@

20
@SET_CCC@
21 22
CC=		@CC@
RANLIB=		@RANLIB@
23 24
AR=		@AR@

25
OPT=		@OPT@
26
LDFLAGS=	@LDFLAGS@
27
LDLAST=		@LDLAST@
28
SGI_ABI=	@SGI_ABI@
29

30 31
DEFS=		@DEFS@
LIBS=		@LIBS@
32 33 34
LIBM=		@LIBM@
LIBC=		@LIBC@

Guido van Rossum's avatar
Guido van Rossum committed
35 36 37
# Machine-dependent subdirectories
MACHDEP=	@MACHDEP@

38 39 40 41 42
# Install prefix for architecture-independent files
prefix=		@prefix@

# Install prefix for architecture-dependent files
exec_prefix=	@exec_prefix@
43

44 45 46 47 48 49 50 51 52 53 54 55 56
# Expanded directories
BINDIR=		$(exec_prefix)/bin
LIBDIR=		$(exec_prefix)/lib
MANDIR=		$(prefix)/man
INCLUDEDIR=	$(prefix)/include
SCRIPTDIR=	$(prefix)/lib

# Detailed destination directories
BINLIBDEST=	$(LIBDIR)/python$(VERSION)
LIBDEST=	$(SCRIPTDIR)/python$(VERSION)
INCLUDEPY=	$(INCLUDEDIR)/python$(VERSION)
LIBP=		$(LIBDIR)/python$(VERSION)

57 58 59 60 61
# Symbols used for using shared libraries
SO=		@SO@
LDSHARED=	@LDSHARED@
CCSHARED=	@CCSHARED@
LINKFORSHARED=	@LINKFORSHARED@
62
DESTSHARED=	$(BINLIBDEST)/lib-dynload
63

64 65
# Portable install script (configure doesn't always guess right)
INSTALL=	@srcdir@/../install-sh -c
66
INSTALL_PROGRAM=${INSTALL} -m 755
67
INSTALL_DATA=	${INSTALL} -m 644
68 69
# Shared libraries must be installed with executable mode on some systems;
# rather than figuring out exactly which, we always give them executable mode.
70 71
# Also, making them read-only seems to be a good idea...
INSTALL_SHARED=	${INSTALL} -m 555
72

73
# === Variables that are customizable by hand or by inclusion in Setup ===
74

75
LINKCC=		@LINKCC@
76
INCLDIR=	$(srcdir)/../Include
77 78
CONFIGINCLDIR=	..
CFLAGS=		$(OPT) -I$(INCLDIR) -I$(CONFIGINCLDIR) $(DEFS)
79 80 81 82

MKDEP=		mkdep
SHELL=		/bin/sh

83
MAKESETUP=	$(srcdir)/makesetup
84

85 86 87 88 89 90 91 92
# (The makesetup script inserts all variable definitions found
# found in the Setup file just below the following line.
# This means that the Setup file can override any of the definitions
# given before this point, but not any given below.
# The script insert the definitions in reverse order,
# for the benefits of independent extensions.)
# === Definitions added by makesetup ===

93 94
# === Fixed definitions ===

Guido van Rossum's avatar
Guido van Rossum committed
95 96
FIXOBJS=	config.o getpath.o main.o getbuildinfo.o
OBJS=		$(MODOBJS) $(FIXOBJS)
97

Guido van Rossum's avatar
Guido van Rossum committed
98
MAINOBJ=	python.o
99

100
SYSLIBS=	$(LIBM) $(LIBC)
101

Guido van Rossum's avatar
Guido van Rossum committed
102
LIBRARY=	../libpython$(VERSION).a
103
REALLIBRARY=	../@REALLIBRARY@
104 105 106

# === Rules ===

107
all:		$(OBJS)
108

Guido van Rossum's avatar
Guido van Rossum committed
109
# This target is used by the master Makefile to add the objects to the library.
110 111
# To deal with the conflict between signalmodule.o and
# sigcheck.o+intrcheck.o, we remove the latter two if we have the former.
112
add2lib:	$(OBJS)
113 114 115 116 117 118
		-for i in $(OBJS); do \
		     if test "$$i" = "signalmodule.o"; then \
		        ar d $(LIBRARY) sigcheck.o intrcheck.o 2>/dev/null; \
			break; \
		     fi; \
		done
Guido van Rossum's avatar
Guido van Rossum committed
119 120 121
		$(AR) cr $(LIBRARY) $(OBJS)
		touch add2lib

122 123 124
# Use ``EXE=.exe'' for Unix emulations on DOS/Windows
EXE=

Guido van Rossum's avatar
Guido van Rossum committed
125 126
# This target is used by the master Makefile to link the final binary.
link:		$(MAINOBJ)
127
		$(LINKCC) $(LDFLAGS) $(LINKFORSHARED) $(MAINOBJ) \
128
		  $(LIBRARY) $(MODLIBS) $(LIBS) $(SYSLIBS) -o python $(LDLAST)
129
		mv python$(EXE) ../python$(EXE)
130 131

clean:
Guido van Rossum's avatar
Guido van Rossum committed
132
		-rm -f *.o python core *~ [@,#]* *.old *.orig *.rej add2lib
133 134

clobber:	clean
135
		-rm -f *.a tags TAGS config.c glmodule.c Makefile.pre
136
		-rm -f *.so *.sl so_locations
137

138 139
getpath.o:	getpath.c Makefile
		$(CC) -c $(CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
140 141
		      -DPREFIX='"$(prefix)"' \
		      -DEXEC_PREFIX='"$(exec_prefix)"' \
142 143
		      -DVERSION='"$(VERSION)"' \
		      -DVPATH='"$(VPATH)"' \
144 145
		      $(srcdir)/getpath.c

Guido van Rossum's avatar
Guido van Rossum committed
146 147 148
# When the configuration changes, we remove the library, so that it
# gets remade from scratch; this ensures to remove modules that are no
# longer pertinent (but that were in a previous configuration).
149 150 151
config.c Makefile: Makefile.pre config.c.in $(MAKESETUP)
config.c Makefile: Setup.thread Setup Setup.local
config.c Makefile:
Guido van Rossum's avatar
Guido van Rossum committed
152
		-rm -f $(LIBRARY)
153
		$(SHELL) $(MAKESETUP) Setup.thread Setup.local Setup
154

155 156
Setup:
		cp $(srcdir)/Setup.in Setup
157

158 159 160
Setup.local:
		echo "# Edit this file for local setup changes" >Setup.local

161 162 163
Makefile.pre:	Makefile.pre.in ../config.status
		(cd ..; CONFIG_FILES=Modules/Makefile.pre CONFIG_HEADERS= \
		$(SHELL) config.status)
164

165 166 167 168 169 170 171 172 173 174 175
depend:
		$(MKDEP) $(CFLAGS) `echo $(OBJS) | tr ' ' '\012' | \
					sed 's|\(.*\)\.o|$(srcdir)/\1.c|'`

.PRECIOUS:	../python

glmodule.c:	$(srcdir)/cgen.py $(srcdir)/cstubs
		python $(srcdir)/cgen.py <$(srcdir)/cstubs >glmodule.c

almodule.o: almodule.c
arraymodule.o: arraymodule.c
176
audioop.o: audioop.c
177
cdmodule.o: cdmodule.c
Guido van Rossum's avatar
Guido van Rossum committed
178
cgensupport.o: cgensupport.c
179 180
clmodule.o: clmodule.c
dbmmodule.o: dbmmodule.c
181
errnomodule.o: errnomodule.c
182 183 184 185
fcntlmodule.o: fcntlmodule.c
flmodule.o: flmodule.c
fmmodule.o: fmmodule.c
glmodule.o: glmodule.c
186 187
imageop.o: imageop.c
imgfile.o: imgfile.c
188
main.o: main.c
189 190 191 192 193
mathmodule.o: mathmodule.c
md5c.o: md5c.c
md5module.o: md5module.c
mpzmodule.o: mpzmodule.c
nismodule.o: nismodule.c
194
operator.o: operator.c
195 196 197 198 199
parsermodule.o: parsermodule.c
posixmodule.o: posixmodule.c
pwdmodule.o: pwdmodule.c
regexmodule.o: regexmodule.c
regexpr.o: regexpr.c
200
resource.o: resource.c
201 202 203 204 205 206 207 208
rgbimgmodule.o: rgbimgmodule.c
rotormodule.o: rotormodule.c
selectmodule.o: selectmodule.c
sgimodule.o: sgimodule.c
socketmodule.o: socketmodule.c
stdwinmodule.o: stdwinmodule.c
stropmodule.o: stropmodule.c
structmodule.o: structmodule.c
209
sunaudiodev.o: sunaudiodev.c
210 211 212 213 214 215 216
svmodule.o: svmodule.c
threadmodule.o: threadmodule.c
timemodule.o: timemodule.c
timingmodule.o: timingmodule.c
xxmodule.o: xxmodule.c
yuvconvert.o: yuvconvert.c

217 218
# Rules to build and install all shared modules
sharedmods:	$(SHAREDMODS)
219
sharedinstall:	$(DESTSHARED) $(SHAREDMODS)
220 221
		-for i in X $(SHAREDMODS); do \
			if test $$i != X; \
222
			then $(INSTALL_SHARED) $$i $(DESTSHARED)/$$i; \
223 224
			fi; \
		done
225

226
DESTDIRS=	$(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED)
227

228 229 230 231 232 233 234 235 236 237
$(DESTSHARED): 
		@for i in $(DESTDIRS); \
		do \
			if test ! -d $$i; then \
				echo "Creating directory $$i"; \
				mkdir $$i; \
				chmod 755 $$i; \
			else	true; \
			fi; \
		done
238

239
# Stuff is appended here by makesetup and make depend