Pre-opened test file needs to be opened in binary mode.
[python.git] / Demo / embed / Makefile
blobddbdd929e2ac6ab9e8057a94c31717dbff0d1482
1 # Makefile for embedded Python use demo.
2 # (This version tailored for my Red Hat Linux 6.1 setup;
3 # edit lines marked with XXX.)
5 # XXX The compiler you are using
6 CC= gcc
8 # XXX Top of the build tree and source tree
9 blddir= ../..
10 srcdir= ../..
12 # Python version
13 VERSION= 2.6
15 # Compiler flags
16 OPT= -g
17 INCLUDES= -I$(srcdir)/Include -I$(blddir)
18 CFLAGS= $(OPT)
19 CPPFLAGS= $(INCLUDES)
21 # The Python library
22 LIBPYTHON= $(blddir)/libpython$(VERSION).a
24 # XXX edit LIBS (in particular) to match $(blddir)/Modules/Makefile
25 LIBS= -lnsl -ldl -lreadline -ltermcap -lieee -lpthread -lutil
26 LDFLAGS= -Xlinker -export-dynamic
27 SYSLIBS= -lm
28 MODLIBS=
29 ALLLIBS= $(LIBPYTHON) $(MODLIBS) $(LIBS) $(SYSLIBS)
31 # Build the demo applications
32 all: demo loop importexc
33 demo: demo.o
34 $(CC) $(LDFLAGS) demo.o $(ALLLIBS) -o demo
36 loop: loop.o
37 $(CC) $(LDFLAGS) loop.o $(ALLLIBS) -o loop
39 importexc: importexc.o
40 $(CC) $(LDFLAGS) importexc.o $(ALLLIBS) -o importexc
42 # Administrative targets
44 test: demo
45 ./demo
47 COMMAND="print 'hello world'"
48 looptest: loop
49 ./loop $(COMMAND)
51 clean:
52 -rm -f *.o core
54 clobber: clean
55 -rm -f *~ @* '#'* demo loop importexc
57 realclean: clobber