blob: 0a69f2de985c7fc10217faa1f3d08507e708da08 [file] [log] [blame]
Guido van Rossum14421771994-09-14 14:06:46 +00001# 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. ken.manheimer@nist.gov, 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
10ARCH= sun4
11prefix= /depot/sundry
12DESTLIB= $(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:
17SOURCES= $(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.
25metalbasemoduleCFLAGS= -I$(prefix)/include/mbase51 -DNO_TIMEB -DNO_USHORT -DNO_ENCRYPT
26metalbasemoduleLDFLAGS= -L/depot/sundry/plat/lib -lmb
27cursesmoduleCFLAGS= -I/usr/5include
28cursesmoduleLDFLAGS= -L/usr/5lib -lcurses -ltermcap
29
30OBJS= $(SOURCES:.c=.so)
31
32CC= gcc
33OPT= -g -O
34DEFS= -DHAVE_CONFIG_H
35INCLDIR= $(prefix)/include/python
36CFLAGS= $(OPT) -I$(INCLDIR) -I.. $(DEFS)
37LD= ld
38
39all: $(OBJS)
40
41%.o: %.c
42 $(CC) -c $(CFLAGS) $(CPPFLAGS) $($*CFLAGS) -o $@ $<
43
44%.so: %.o
45 $(LD) $(LDFLAGS) -o $@ $< $($*LDFLAGS) $(LOADLIBES)
46
47PHONY: echo # For testing derivation of $(OBJS).
48echo:
49 @echo "(Set SOURCES def if you don't see a '.so' for each '.c' between the brackets)"
50 @echo :$(OBJS):
51
52PHONY : install
53install: $(OBJS)
54 ls $(OBJS) | cpio -pm $(DESTLIB)
55
56PHONY : clean
57clean:
58 rm -f *.o *.so