|
| 1 | +# Makefile to do general-coverage creation of dynamic-load libraries |
| 2 | +# from python C-module sources. |
| 3 | + |
| 4 | +# $Id$ |
| 5 | +# Created by Ken Manheimer, Jul-1994. [email protected], 301 975-3539 |
| 6 | + |
| 7 | +# To configure for your site, select the appropriate SOURCES and macro |
| 8 | +# def and assign the right path to the prefix macro. |
| 9 | + |
| 10 | +ARCH= sun4 |
| 11 | +prefix= /depot/sundry |
| 12 | +DESTLIB= $(prefix)/lib/python/$(ARCH) |
| 13 | + |
| 14 | +### For Sun Make; tested in v 1.0, under both SunOS 4.1.3 and SunOS 5.3: |
| 15 | +#SOURCES:sh= echo *.c |
| 16 | +### For Gnu Make; works at least for v 3.59: |
| 17 | +SOURCES= $(wildcard *.c) |
| 18 | + |
| 19 | +# To configure for a new module: |
| 20 | +# - put the module in the current directory |
| 21 | +# - if it doesn't require any special compile or load options, that's it. |
| 22 | +# - if it does require special compile or load options, create a macro |
| 23 | +# composed of the (full) module name, sans suffix, plus 'CFLAGS' or |
| 24 | +# 'LDFLAGS', depending on the compile phase in question. |
| 25 | +metalbasemoduleCFLAGS= -I$(prefix)/include/mbase51 -DNO_TIMEB -DNO_USHORT -DNO_ENCRYPT |
| 26 | +metalbasemoduleLDFLAGS= -L/depot/sundry/plat/lib -lmb |
| 27 | +cursesmoduleCFLAGS= -I/usr/5include |
| 28 | +cursesmoduleLDFLAGS= -L/usr/5lib -lcurses -ltermcap |
| 29 | + |
| 30 | +OBJS= $(SOURCES:.c=.so) |
| 31 | + |
| 32 | +CC= gcc |
| 33 | +OPT= -g -O |
| 34 | +DEFS= -DHAVE_CONFIG_H |
| 35 | +INCLDIR= $(prefix)/include/python |
| 36 | +CFLAGS= $(OPT) -I$(INCLDIR) -I.. $(DEFS) |
| 37 | +LD= ld |
| 38 | + |
| 39 | +all: $(OBJS) |
| 40 | + |
| 41 | +%.o: %.c |
| 42 | + $(CC) -c $(CFLAGS) $(CPPFLAGS) $($*CFLAGS) -o $@ $< |
| 43 | + |
| 44 | +%.so: %.o |
| 45 | + $(LD) $(LDFLAGS) -o $@ $< $($*LDFLAGS) $(LOADLIBES) |
| 46 | + |
| 47 | +PHONY: echo # For testing derivation of $(OBJS). |
| 48 | +echo: |
| 49 | + @echo "(Set SOURCES def if you don't see a '.so' for each '.c' between the brackets)" |
| 50 | + @echo :$(OBJS): |
| 51 | + |
| 52 | +PHONY : install |
| 53 | +install: $(OBJS) |
| 54 | + ls $(OBJS) | cpio -pm $(DESTLIB) |
| 55 | + |
| 56 | +PHONY : clean |
| 57 | +clean: |
| 58 | + rm -f *.o *.so |
0 commit comments