Blob


2 # this works in gnu make
3 SYSNAME:=${shell uname}
4 OBJTYPE:=${shell uname -m | sed 's;i.86;386;; s;/.*;;; s; ;;g'}
6 # this works in bsd make
7 SYSNAME!=uname
8 OBJTYPE!=uname -m | sed 's;i.86;386;; s;/.*;;; s; ;;g'
10 # the gnu rules will mess up bsd but not vice versa,
11 # hence the gnu rules come first.
13 include Make.$(SYSNAME)-$(OBJTYPE)
15 PREFIX=/usr/local
17 NUKEFILES=
19 TGZFILES=
21 LIB=lib9.a
22 VERSION=2.0
23 PORTPLACE=devel/lib9
24 NAME=lib9
26 OFILES=\
27 _exits.$O\
28 argv0.$O\
29 await.$O\
30 encodefmt.$O\
31 errstr.$O\
32 exits.$O\
33 ffork-$(SYSNAME).$O\
34 getcallerpc-$(OBJTYPE).$O\
35 getfields.$O\
36 lock.$O\
37 malloctag.$O\
38 mallocz.$O\
39 nrand.$O\
40 qlock.$O\
41 readn.$O\
42 rendez.$O\
43 strecpy.$O\
44 sysfatal.$O\
45 tas-$(OBJTYPE).$O\
46 tokenize.$O\
47 u16.$O\
48 u32.$O\
49 u64.$O\
50 wait.$O\
51 werrstr.$O\
53 HFILES=\
54 lib9.h\
56 all: $(LIB)
58 install: $(LIB)
59 test -d $(PREFIX)/man/man3 || mkdir $(PREFIX)/man/man3
60 # install -m 0644 lib9.3 $(PREFIX)/man/man3/lib9.3
61 install -m 0644 lib9.h $(PREFIX)/include/lib9.h
62 install -m 0644 $(LIB) $(PREFIX)/lib/$(LIB)
64 test: $(LIB) test.$O
65 $(CC) -o test test.$O $(LIB) -L$(PREFIX)/lib -lfmt -lutf
67 testfork: $(LIB) testfork.$O
68 $(CC) -o testfork testfork.$O $(LIB) -L$(PREFIX)/lib -lfmt -lutf
70 $(LIB): $(OFILES)
71 $(AR) $(ARFLAGS) $(LIB) $(OFILES)
73 NUKEFILES+=$(LIB)
74 .c.$O:
75 $(CC) $(CFLAGS) -I$(PREFIX)/include $*.c
77 %.$O: %.c
78 $(CC) $(CFLAGS) -I$(PREFIX)/include $*.c
81 $(OFILES): $(HFILES)
83 tgz:
84 rm -rf $(NAME)-$(VERSION)
85 mkdir $(NAME)-$(VERSION)
86 cp Makefile Make.* README LICENSE NOTICE *.[ch137] rpm.spec bundle.ports $(TGZFILES) $(NAME)-$(VERSION)
87 tar cf - $(NAME)-$(VERSION) | gzip >$(NAME)-$(VERSION).tgz
88 rm -rf $(NAME)-$(VERSION)
90 clean:
91 rm -f $(OFILES) $(LIB)
93 nuke:
94 rm -f $(OFILES) *.tgz *.rpm $(NUKEFILES)
96 rpm:
97 make tgz
98 cp $(NAME)-$(VERSION).tgz /usr/src/RPM/SOURCES
99 rpm -ba rpm.spec
100 cp /usr/src/RPM/SRPMS/$(NAME)-$(VERSION)-1.src.rpm .
101 cp /usr/src/RPM/RPMS/i586/$(NAME)-$(VERSION)-1.i586.rpm .
102 scp *.rpm rsc@amsterdam.lcs.mit.edu:public_html/software
104 PORTDIR=/usr/ports/$(PORTPLACE)
106 ports:
107 make tgz
108 rm -rf $(PORTDIR)
109 mkdir $(PORTDIR)
110 cp $(NAME)-$(VERSION).tgz /usr/ports/distfiles
111 cat bundle.ports | (cd $(PORTDIR) && awk '$$1=="---" && $$3=="---" { ofile=$$2; next} {if(ofile) print >ofile}')
112 (cd $(PORTDIR); make makesum)
113 (cd $(PORTDIR); make)
114 (cd $(PORTDIR); /usr/local/bin/portlint)
115 rm -rf $(PORTDIR)/work
116 shar `find $(PORTDIR)` > ports.shar
117 (cd $(PORTDIR); tar cf - *) | gzip >$(NAME)-$(VERSION)-ports.tgz
118 scp *.tgz rsc@amsterdam.lcs.mit.edu:public_html/software
120 .phony: all clean nuke install tgz rpm ports