summaryrefslogtreecommitdiffstats
path: root/Modules/Makefile.pre.in
blob: cd53ae68ad44858aeb09d2033e38b5d5d47c1251 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
# 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.)

# Interpreter version number, for library destination pathnames
VERSION=	1.4

# === Variables set by makesetup ===

MODOBJS=	_MODOBJS_
MODLIBS=	_MODLIBS_

# === Variables set by configure ===

srcdir=		@srcdir@
VPATH=		@srcdir@

CC=		@CC@
RANLIB=		@RANLIB@
AR=		@AR@

OPT=		@OPT@

DEFS=		@DEFS@
LIBS=		@LIBS@
LIBM=		@LIBM@
LIBC=		@LIBC@

# Machine-dependent subdirectories
MACHDEP=	@MACHDEP@

# Install prefix for architecture-independent files
prefix=		@prefix@

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

# 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)

# Symbols used for using shared libraries
SO=		@SO@
LDSHARED=	@LDSHARED@
CCSHARED=	@CCSHARED@
LINKFORSHARED=	@LINKFORSHARED@
DESTSHARED=	$(BINLIBDEST)/sharedmodules

# Portable install script (configure doesn't always guess right)
INSTALL=	@srcdir@/../install-sh -c
INSTALL_PROGRAM=${INSTALL} -m 755
INSTALL_DATA=	${INSTALL} -m 644

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

LINKCC=		$(CC)
INCLDIR=	$(srcdir)/../Include
CONFIGINCLDIR=	..
CFLAGS=		$(OPT) -I$(INCLDIR) -I$(CONFIGINCLDIR) $(DEFS)

MKDEP=		mkdep
SHELL=		/bin/sh

MAKESETUP=	$(srcdir)/makesetup

# (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 ===

# === Fixed definitions ===

OBJS=		$(MODOBJS)

ADDOBJS=	main.o config.o getpath.o

LIB=		libModules.a

MYLIBS=		$(LIB) \
		../Python/libPython.a \
		../Objects/libObjects.a \
		../Parser/libParser.a

SYSLIBS=	$(LIBM) $(LIBC)


# === Rules ===

all:		$(LIB) ../python sharedmods

asharedmodule:	$(ASHAREDMODULE)$(SO)

$(ASHAREDMODULE)$(SO): $(ASHAREDMODULESOBS)
	$(LDSHARED) -o $(ASHAREDMODULE)$(SO) $(ASHAREDMODULESOBS) \
	$(ASHAREDMODULESEXTRA)

$(LIB):		$& $(OBJS) Makefile
		-rm -f $(LIB)
		$(AR) cr $(LIB) $(OBJS)
		$(RANLIB) $(LIB)

../python:	$(MYLIBS) $(ADDOBJS) Makefile
		$(LINKCC) $(OPT) $(LINKFORSHARED) $(ADDOBJS) \
		      $(MYLIBS) $(MODLIBS) $(LIBS) $(SYSLIBS) -o python
		mv python ../python

clean:
		-rm -f *.o python core *~ [@,#]* *.old *.orig *.rej

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

getpath.o:	getpath.c Makefile
		$(CC) -c $(CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
		      -DPREFIX='"$(prefix)"' \
		      -DEXEC_PREFIX='"$(exec_prefix)"' \
		      $(srcdir)/getpath.c

config.c Makefile: Makefile.pre config.c.in $(MAKESETUP) Setup
		$(SHELL) $(MAKESETUP) Setup

Setup:
		cp $(srcdir)/Setup.in Setup

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

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
audioop.o: audioop.c
cdmodule.o: cdmodule.c
clmodule.o: clmodule.c
dbmmodule.o: dbmmodule.c
fcntlmodule.o: fcntlmodule.c
flmodule.o: flmodule.c
fmmodule.o: fmmodule.c
glmodule.o: glmodule.c
imageop.o: imageop.c
imgfile.o: imgfile.c
main.o: main.c
mathmodule.o: mathmodule.c
md5c.o: md5c.c
md5module.o: md5module.c
mpzmodule.o: mpzmodule.c
nismodule.o: nismodule.c
parsermodule.o: parsermodule.c
posixmodule.o: posixmodule.c
pwdmodule.o: pwdmodule.c
regexmodule.o: regexmodule.c
regexpr.o: regexpr.c
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
sunaudiodev.o: sunaudiodev.c
svmodule.o: svmodule.c
threadmodule.o: threadmodule.c
timemodule.o: timemodule.c
timingmodule.o: timingmodule.c
xxmodule.o: xxmodule.c
yuvconvert.o: yuvconvert.c

# Rules to build and install all shared modules
sharedmods:	$(SHAREDMODS)
sharedinstall:	$(DESTSHARED) $(SHAREDMODS)
		-for i in X $(SHAREDMODS); do \
			if test $$i != X; \
			then $(INSTALL_DATA) $$i $(DESTSHARED)/$$i; \
			fi; \
		done

# Install a shared module from outside of setup
asharedinstall:	$(DESTSHARED) $(ASHAREDMODULE)$(SO)
		-for i in dummy $(ASHAREDMODULE)$(SO); do \
		    if test -f $$i; then mv $$i $(DESTSHARED)/$$i; fi; done

# This is handy when modules need to know where the destination directory is:
echodestshared: $(DESTSHARED)
	echo 	$(DESTSHARED)

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

$(DESTSHARED): 
		@for i in $(DESTDIRS); \
		do \
			if test ! -d $$i; then \
				echo "Creating directory $$i"; \
				mkdir $$i; \
				chmod 755 $$i; \
			else	true; \
			fi; \
		done

# Stuff is appended here by makesetup and make depend