Makefile 1.13 KB
Newer Older
1
# Makefile for embedded Python use demo.
2 3
# (This version tailored for my Red Hat Linux 6.1 setup;
# edit lines marked with XXX.)
Guido van Rossum's avatar
Guido van Rossum committed
4

5 6 7 8
# XXX The compiler you are using
CC=	 	gcc

# XXX Top of the build tree and source tree
Barry Warsaw's avatar
Barry Warsaw committed
9
blddir=		../..
Guido van Rossum's avatar
Guido van Rossum committed
10 11
srcdir=		../..

12
# Python version
Barry Warsaw's avatar
Barry Warsaw committed
13
VERSION=	2.1
14

Guido van Rossum's avatar
Guido van Rossum committed
15 16 17
# Compiler flags
OPT=		-g
INCLUDES=	-I$(srcdir)/Include -I$(blddir)
18
CFLAGS=		$(OPT) $(INCLUDES)
Guido van Rossum's avatar
Guido van Rossum committed
19

20
# The Python library
21
LIBPYTHON=	$(blddir)/libpython$(VERSION).a
22

23
# XXX edit LIBS (in particular) to match $(blddir)/Modules/Makefile
24
LIBS=		-lnsl -ldl -lreadline -ltermcap -lieee -lpthread -lutil
25
LDFLAGS=	-Xlinker -export-dynamic
Guido van Rossum's avatar
Guido van Rossum committed
26
SYSLIBS=	-lm
27 28
MODLIBS=	
ALLLIBS=	$(LIBPYTHON) $(MODLIBS) $(LIBS) $(SYSLIBS)
Guido van Rossum's avatar
Guido van Rossum committed
29 30

# Build the demo application
Barry Warsaw's avatar
Barry Warsaw committed
31
all:		demo loop importexc
32
demo:		demo.o
33
		$(CC) $(LDFLAGS) demo.o $(ALLLIBS) -o demo
Guido van Rossum's avatar
Guido van Rossum committed
34

35 36 37
loop:		loop.o
		$(CC) $(LDFLAGS) loop.o $(ALLLIBS) -o loop

Barry Warsaw's avatar
Barry Warsaw committed
38 39
importexc:	importexc.o
		$(CC) $(LDFLAGS) importexc.o $(ALLLIBS) -o importexc
40

Guido van Rossum's avatar
Guido van Rossum committed
41 42 43 44 45
# Administrative targets

test:		demo
		./demo

46 47 48 49
COMMAND="print 'hello world'"
looptest:	loop
		./loop $(COMMAND)

Guido van Rossum's avatar
Guido van Rossum committed
50 51 52 53
clean:
		-rm -f *.o core

clobber:	clean
Barry Warsaw's avatar
Barry Warsaw committed
54 55 56
		-rm -f *~ @* '#'* demo loop importexc

realclean:	clobber