Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f6ca6aa

Browse files
committed
New build procedure.
1 parent 914fbd9 commit f6ca6aa

4 files changed

Lines changed: 66 additions & 58 deletions

File tree

Modules/Makefile.pre.in

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,14 @@
66
# brought up to date by running "make Makefile". (The makesetup also
77
# creates config.c from config.c.in in the source directory.)
88

9-
# Interpreter version number, for library destination pathnames
10-
VERSION= 1.5
11-
129
# === Variables set by makesetup ===
1310

1411
MODOBJS= _MODOBJS_
1512
MODLIBS= _MODLIBS_
1613

1714
# === Variables set by configure ===
1815

16+
VERSION= @VERSION@
1917
srcdir= @srcdir@
2018
VPATH= @srcdir@
2119

@@ -92,51 +90,51 @@ MAKESETUP= $(srcdir)/makesetup
9290

9391
# === Fixed definitions ===
9492

95-
OBJS= $(MODOBJS)
96-
97-
# XXX Should getpath.o (and may be others) be added to OBJS?
98-
99-
ADDOBJS= main.o config.o getpath.o getbuildinfo.o
93+
FIXOBJS= config.o getpath.o main.o getbuildinfo.o
94+
OBJS= $(MODOBJS) $(FIXOBJS)
10095

101-
LIB= libModules.a
102-
103-
MYLIBS= $(LIB) \
104-
../Python/libPython.a \
105-
../Objects/libObjects.a \
106-
../Parser/libParser.a
96+
MAINOBJ= python.o
10797

10898
SYSLIBS= $(LIBM) $(LIBC)
10999

100+
LIBRARY= ../libpython$(VERSION).a
110101

111102
# === Rules ===
112103

113-
all: $(LIB) ../python sharedmods
104+
all: $(OBJS) sharedmods
114105

106+
# Targets for Jim Fulton's extension Makefiles -- are these still needed?
115107
asharedmodule: $(ASHAREDMODULE)$(SO)
116108

117109
$(ASHAREDMODULE)$(SO): $(ASHAREDMODULESOBS)
118110
$(LDSHARED) $(LDFLAGS) -o $(ASHAREDMODULE)$(SO) $(ASHAREDMODULESOBS) \
119111
$(ASHAREDMODULESEXTRA)
120112

121-
$(LIB): $& $(OBJS) Makefile
122-
-rm -f $(LIB)
123-
$(AR) cr $(LIB) $(OBJS)
124-
$(RANLIB) $(LIB)
125-
126-
../python: $(MYLIBS) $(ADDOBJS) Makefile buildno
113+
# 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.
116+
add2lib: $(OBJS) buildno
127117
expr `cat buildno` + 1 >@buildno
128118
mv @buildno buildno
129-
$(CC) -c $(CFLAGS) -DBUILD=`cat buildno` $(srcdir)/getbuildinfo.c
130-
$(AR) r $(LIB) getbuildinfo.o
131-
$(LINKCC) $(LDFLAGS) $(OPT) $(LINKFORSHARED) $(ADDOBJS) \
132-
$(MYLIBS) $(MODLIBS) $(LIBS) $(SYSLIBS) -o python $(LDLAST)
119+
$(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.
128+
link: $(MAINOBJ)
129+
$(LINKCC) $(LDFLAGS) $(OPT) $(LINKFORSHARED) $(MAINOBJ) \
130+
$(LIBRARY) $(MODLIBS) $(LIBS) $(SYSLIBS) -o python $(LDLAST)
133131
mv python ../python
134132

135133
buildno:
136134
echo 0 >buildno
137135

138136
clean:
139-
-rm -f *.o python core *~ [@,#]* *.old *.orig *.rej
137+
-rm -f *.o python core *~ [@,#]* *.old *.orig *.rej add2lib
140138

141139
clobber: clean
142140
-rm -f *.a tags TAGS config.c glmodule.c Makefile.pre
@@ -150,7 +148,11 @@ getpath.o: getpath.c Makefile
150148
-DVPATH='"$(VPATH)"' \
151149
$(srcdir)/getpath.c
152150

151+
# 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).
153154
config.c Makefile: Makefile.pre config.c.in $(MAKESETUP) Setup Setup.local
155+
-rm -f $(LIBRARY)
154156
$(SHELL) $(MAKESETUP) Setup Setup.local
155157

156158
Setup:

Objects/Makefile.in

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
# === Variables set by config.stat ===
66

7+
VERSION= @VERSION@
8+
79
srcdir= @srcdir@
810
VPATH= @srcdir@
911

@@ -44,20 +46,19 @@ SRCS= abstract.c \
4446
sliceobject.c stringobject.c \
4547
tupleobject.c typeobject.c
4648

47-
LIB= libObjects.a
48-
49+
LIBRARY= ../libpython$(VERSION).a
4950

5051
# === Rules ===
5152

52-
all: $(LIB)
53+
all: $(OBJS)
5354

54-
$(LIB): $& $(OBJS)
55-
-rm -f $(LIB)
56-
$(AR) cr $(LIB) $(OBJS)
57-
$(RANLIB) $(LIB)
55+
# This target is used by the master Makefile to add the objects to the library
56+
add2lib: $(OBJS)
57+
$(AR) cr $(LIBRARY) $(OBJS)
58+
touch add2lib
5859

5960
clean:
60-
-rm -f *.o core *~ [@,#]* *.old *.orig *.rej
61+
-rm -f *.o core *~ [@,#]* *.old *.orig *.rej add2lib
6162

6263
clobber: clean
6364
-rm -f *.a tags TAGS

Parser/Makefile.in

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
# === Variables set by config.stat ===
66

7+
VERSION= @VERSION@
8+
79
srcdir= @srcdir@
810
VPATH= @srcdir@
911

@@ -26,35 +28,38 @@ SHELL= /bin/sh
2628

2729
# === Fixed definitions ===
2830

29-
PARSEROBJS= acceler.o grammar1.o \
30-
intrcheck.o listnode.o myreadline.o node.o parser.o \
31+
POBJS= acceler.o grammar1.o \
32+
listnode.o node.o parser.o \
3133
parsetok.o tokenizer.o bitset.o \
3234
firstsets.o grammar.o metagrammar.o pgen.o \
3335
printgrammar.o
3436

35-
PGENOBJS= pgenmain.o
37+
OBJS= $(POBJS) intrcheck.o myreadline.o
3638

37-
OBJS= $(PGENOBJS) $(PARSEROBJS)
39+
PGENMAIN= pgenmain.o
3840

39-
PGEN= pgen
41+
PGENOBJS= $(PGENMAIN) $(POBJS)
4042

41-
LIB= libParser.a
43+
DOBJS= $(PGENMAIN) $(OBJS)
44+
45+
PGEN= pgen
4246

47+
LIBRARY= ../libpython$(VERSION).a
4348

4449
# === Rules ===
4550

46-
all: $(LIB) $(PGEN)
51+
all: $(PGEN) $(OBJS)
4752

48-
$(LIB): $& $(PARSEROBJS)
49-
-rm -f $(LIB)
50-
$(AR) cr $(LIB) $(PARSEROBJS)
51-
$(RANLIB) $(LIB)
53+
# This target is used by the master Makefile to add the objects to the library
54+
add2lib: $(OBJS)
55+
$(AR) cr $(LIBRARY) $(OBJS)
56+
touch add2lib
5257

53-
$(PGEN): $(PGENOBJS) $(LIB)
54-
$(CC) $(OPT) $(PGENOBJS) $(LIB) -o $(PGEN)
58+
$(PGEN): $(PGENOBJS)
59+
$(CC) $(OPT) $(PGENOBJS) -o $(PGEN)
5560

5661
clean:
57-
-rm -f *.o core *~ [@,#]* *.old *.orig *.rej
62+
-rm -f *.o core *~ [@,#]* *.old *.orig *.rej add2lib
5863

5964
clobber: clean
6065
-rm -f $(PGEN) *.a tags TAGS
@@ -64,7 +69,7 @@ Makefile: $(srcdir)/Makefile.in ../config.status
6469
$(SHELL) config.status)
6570

6671
depend:
67-
$(MKDEP) $(CFLAGS) `echo $(OBJS) | tr ' ' '\012' | \
72+
$(MKDEP) $(CFLAGS) `echo $(DOBJS) | tr ' ' '\012' | \
6873
sed 's|\(.*\)\.o|$(srcdir)/\1.c|'`
6974

7075
.PRECIOUS: Makefile

Python/Makefile.in

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
# === Variables set by config.stat ===
66

7+
VERSION= @VERSION@
8+
79
srcdir= @srcdir@
810
VPATH= @srcdir@
911

@@ -46,22 +48,20 @@ OBJS= \
4648
traceback.o \
4749
$(LIBOBJS)
4850

49-
LIB= libPython.a
50-
51-
SYSLIBS= -lm
51+
LIBRARY= ../libpython$(VERSION).a
5252

5353

5454
# === Rules ===
5555

56-
all: $(LIB)
56+
all: $(OBJS)
5757

58-
$(LIB): $& $(OBJS)
59-
-rm -f $(LIB)
60-
$(AR) cr $(LIB) $(OBJS)
61-
$(RANLIB) $(LIB)
58+
# This target is used by the master Makefile to add the objects to the library
59+
add2lib: $(OBJS)
60+
$(AR) cr $(LIBRARY) $(OBJS)
61+
touch add2lib
6262

6363
clean:
64-
-rm -f *.o core *~ [@,#]* *.old *.orig *.rej
64+
-rm -f *.o core *~ [@,#]* *.old *.orig *.rej add2lib
6565

6666
clobber: clean
6767
-rm -f *.a tags TAGS

0 commit comments

Comments
 (0)