1 # Makefile for embedded Python use demo. 2 # (This version originally written on Red Hat Linux 6.1; 3 # edit lines marked with XXX.) 4 5 # XXX The compiler you are using 6 CC= gcc 7 8 # XXX Top of the build tree and source tree 9 blddir= ../.. 10 srcdir= ../.. 11 12 # Python version 13 VERSION= 2.7 14 15 # Compiler flags 16 OPT= -g 17 INCLUDES= -I$(srcdir)/Include -I$(blddir) 18 CFLAGS= $(OPT) 19 CPPFLAGS= $(INCLUDES) 20 21 # The Python library 22 LIBPYTHON= $(blddir)/libpython$(VERSION).a 23 24 # XXX edit LIBS (in particular) to match $(blddir)/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) 30 31 # Build the demo applications 32 all: demo loop importexc 33 demo: demo.o 34 $(CC) $(LDFLAGS) demo.o $(ALLLIBS) -o demo 35 36 loop: loop.o 37 $(CC) $(LDFLAGS) loop.o $(ALLLIBS) -o loop 38 39 importexc: importexc.o 40 $(CC) $(LDFLAGS) importexc.o $(ALLLIBS) -o importexc 41 42 # Administrative targets 43 44 test: demo 45 ./demo 46 47 COMMAND="print 'hello world'" 48 looptest: loop 49 ./loop $(COMMAND) 50 51 clean: 52 -rm -f *.o core 53 54 clobber: clean 55 -rm -f *~ @* '#'* demo loop importexc 56 57 realclean: clobber 58