blob: c8d538b608d1f91da54972e94aff15f79c2d517e [file] [log] [blame]
Guido van Rossum6e614e31997-07-19 20:58:50 +00001# Makefile for embedded Python use demo.
Guido van Rossum964f1232000-07-10 14:35:12 +00002# (This version tailored for my Red Hat Linux 6.1 setup;
3# edit lines marked with XXX.)
Guido van Rossum705d5171994-10-08 19:30:50 +00004
Guido van Rossum6e614e31997-07-19 20:58:50 +00005# XXX The compiler you are using
6CC= gcc
7
8# XXX Top of the build tree and source tree
Barry Warsaw7d23b592001-01-23 16:38:57 +00009blddir= ../..
Guido van Rossum705d5171994-10-08 19:30:50 +000010srcdir= ../..
11
Guido van Rossum6e614e31997-07-19 20:58:50 +000012# Python version
Fred Drakeead36d72002-07-25 16:23:21 +000013VERSION= 2.3
Guido van Rossum6e614e31997-07-19 20:58:50 +000014
Guido van Rossum705d5171994-10-08 19:30:50 +000015# Compiler flags
16OPT= -g
17INCLUDES= -I$(srcdir)/Include -I$(blddir)
Neil Schemenauer89e90d62001-06-02 06:16:02 +000018CFLAGS= $(OPT)
19CPPFLAGS= $(INCLUDES)
Guido van Rossum705d5171994-10-08 19:30:50 +000020
Guido van Rossum6e614e31997-07-19 20:58:50 +000021# The Python library
Guido van Rossum964f1232000-07-10 14:35:12 +000022LIBPYTHON= $(blddir)/libpython$(VERSION).a
Guido van Rossum3caad8c1995-03-28 09:22:53 +000023
Guido van Rossum6e614e31997-07-19 20:58:50 +000024# XXX edit LIBS (in particular) to match $(blddir)/Modules/Makefile
Guido van Rossum964f1232000-07-10 14:35:12 +000025LIBS= -lnsl -ldl -lreadline -ltermcap -lieee -lpthread -lutil
Guido van Rossumc7166842000-07-10 16:22:12 +000026LDFLAGS= -Xlinker -export-dynamic
Guido van Rossum705d5171994-10-08 19:30:50 +000027SYSLIBS= -lm
Guido van Rossum6e614e31997-07-19 20:58:50 +000028MODLIBS=
29ALLLIBS= $(LIBPYTHON) $(MODLIBS) $(LIBS) $(SYSLIBS)
Guido van Rossum705d5171994-10-08 19:30:50 +000030
Fred Drakeead36d72002-07-25 16:23:21 +000031# Build the demo applications
Barry Warsawd5221a32001-02-20 20:53:37 +000032all: demo loop importexc
Guido van Rossum6e614e31997-07-19 20:58:50 +000033demo: demo.o
Guido van Rossumc7166842000-07-10 16:22:12 +000034 $(CC) $(LDFLAGS) demo.o $(ALLLIBS) -o demo
Guido van Rossum705d5171994-10-08 19:30:50 +000035
Guido van Rossum3559d1f2001-01-10 17:11:51 +000036loop: loop.o
37 $(CC) $(LDFLAGS) loop.o $(ALLLIBS) -o loop
38
Barry Warsawd5221a32001-02-20 20:53:37 +000039importexc: importexc.o
40 $(CC) $(LDFLAGS) importexc.o $(ALLLIBS) -o importexc
Barry Warsawe98626d2001-01-31 22:18:49 +000041
Guido van Rossum705d5171994-10-08 19:30:50 +000042# Administrative targets
43
44test: demo
45 ./demo
46
Guido van Rossum3559d1f2001-01-10 17:11:51 +000047COMMAND="print 'hello world'"
48looptest: loop
49 ./loop $(COMMAND)
50
Guido van Rossum705d5171994-10-08 19:30:50 +000051clean:
52 -rm -f *.o core
53
54clobber: clean
Barry Warsawd5221a32001-02-20 20:53:37 +000055 -rm -f *~ @* '#'* demo loop importexc
56
57realclean: clobber