blob: c709ec6f0cd9734f136c276b40968f16780722ea [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
Barry Warsaw7d23b592001-01-23 16:38:57 +000013VERSION= 2.1
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)
Guido van Rossum6e614e31997-07-19 20:58:50 +000018CFLAGS= $(OPT) $(INCLUDES)
Guido van Rossum705d5171994-10-08 19:30:50 +000019
Guido van Rossum6e614e31997-07-19 20:58:50 +000020# The Python library
Guido van Rossum964f1232000-07-10 14:35:12 +000021LIBPYTHON= $(blddir)/libpython$(VERSION).a
Guido van Rossum3caad8c1995-03-28 09:22:53 +000022
Guido van Rossum6e614e31997-07-19 20:58:50 +000023# XXX edit LIBS (in particular) to match $(blddir)/Modules/Makefile
Guido van Rossum964f1232000-07-10 14:35:12 +000024LIBS= -lnsl -ldl -lreadline -ltermcap -lieee -lpthread -lutil
Guido van Rossumc7166842000-07-10 16:22:12 +000025LDFLAGS= -Xlinker -export-dynamic
Guido van Rossum705d5171994-10-08 19:30:50 +000026SYSLIBS= -lm
Guido van Rossum6e614e31997-07-19 20:58:50 +000027MODLIBS=
28ALLLIBS= $(LIBPYTHON) $(MODLIBS) $(LIBS) $(SYSLIBS)
Guido van Rossum705d5171994-10-08 19:30:50 +000029
30# Build the demo application
31all: demo
Guido van Rossum6e614e31997-07-19 20:58:50 +000032demo: demo.o
Guido van Rossumc7166842000-07-10 16:22:12 +000033 $(CC) $(LDFLAGS) demo.o $(ALLLIBS) -o demo
Guido van Rossum705d5171994-10-08 19:30:50 +000034
Guido van Rossum3559d1f2001-01-10 17:11:51 +000035loop: loop.o
36 $(CC) $(LDFLAGS) loop.o $(ALLLIBS) -o loop
37
Guido van Rossum705d5171994-10-08 19:30:50 +000038# Administrative targets
39
40test: demo
41 ./demo
42
Guido van Rossum3559d1f2001-01-10 17:11:51 +000043COMMAND="print 'hello world'"
44looptest: loop
45 ./loop $(COMMAND)
46
Guido van Rossum705d5171994-10-08 19:30:50 +000047clean:
48 -rm -f *.o core
49
50clobber: clean
Guido van Rossum3559d1f2001-01-10 17:11:51 +000051 -rm -f *~ @* '#'* demo loop