blob: 343ce196e1370f68dd124dfb0bfdc529e4a646fe [file] [log] [blame]
Alexander Gutkin439f3d12014-02-28 11:33:45 +00001
2# this works in gnu make
3SYSNAME:=${shell uname}
4OBJTYPE:=${shell uname -m | sed 's;i.86;386;; s;/.*;;; s; ;;g'}
5
6# this works in bsd make
7SYSNAME!=uname
8OBJTYPE!=uname -m | sed 's;i.86;386;; s;amd64;x864_64;; s;/.*;;; s; ;;g'
9
10# the gnu rules will mess up bsd but not vice versa,
11# hence the gnu rules come first.
12
13RANLIB=true
14
15include Make.$(SYSNAME)-$(OBJTYPE)
16
17PREFIX=/usr/local
18
19NUKEFILES=
20
21TGZFILES=
22
23CLEANFILES=
24
25LIB=libutf.a
26VERSION=2.0
27PORTPLACE=devel/libutf
28NAME=libutf
29
30OFILES=\
31 rune.$O\
32 runestrcat.$O\
33 runestrchr.$O\
34 runestrcmp.$O\
35 runestrcpy.$O\
36 runestrdup.$O\
37 runestrlen.$O\
38 runestrecpy.$O\
39 runestrncat.$O\
40 runestrncmp.$O\
41 runestrncpy.$O\
42 runestrrchr.$O\
43 runestrstr.$O\
44 runetype.$O\
45 utfecpy.$O\
46 utflen.$O\
47 utfnlen.$O\
48 utfrrune.$O\
49 utfrune.$O\
50 utfutf.$O\
51
52HFILES=\
53 utf.h\
54
55all: $(LIB)
56
57install: $(LIB)
58 mkdir -p $(PREFIX)/share/man/man3 $(PREFIX)/man/man7
59 install -c -m 0644 isalpharune.3 $(PREFIX)/share/man/man3/isalpharune.3
60 install -c -m 0644 utf.7 $(PREFIX)/man/man7/utf.7
61 install -c -m 0644 rune.3 $(PREFIX)/share/man/man3/rune.3
62 install -c -m 0644 runestrcat.3 $(PREFIX)/share/man/man3/runestrcat.3
63 mkdir -p $(PREFIX)/include
64 install -c -m 0644 utf.h $(PREFIX)/include/utf.h
65 mkdir -p $(PREFIX)/lib
66 install -c -m 0644 $(LIB) $(PREFIX)/lib/$(LIB)
67
68$(LIB): $(OFILES)
69 $(AR) $(ARFLAGS) $(LIB) $(OFILES)
70 $(RANLIB) $(LIB)
71
72NUKEFILES+=$(LIB)
73.c.$O:
74 $(CC) $(CFLAGS) -I../libutf -I../libfmt -I../libbio -I../libregexp -I$(PREFIX)/include $*.c
75
76%.$O: %.c
77 $(CC) $(CFLAGS) -I../libutf -I../libfmt -I../libbio -I../libregexp -I$(PREFIX)/include $*.c
78
79
80$(OFILES): $(HFILES)
81
82tgz:
83 rm -rf $(NAME)-$(VERSION)
84 mkdir $(NAME)-$(VERSION)
85 cp Makefile Make.* README LICENSE NOTICE *.[ch137] rpm.spec bundle.ports $(TGZFILES) $(NAME)-$(VERSION)
86 tar cf - $(NAME)-$(VERSION) | gzip >$(NAME)-$(VERSION).tgz
87 rm -rf $(NAME)-$(VERSION)
88
89clean:
90 rm -f $(OFILES) $(LIB) $(CLEANFILES)
91
92nuke:
93 rm -f $(OFILES) *.tgz *.rpm $(NUKEFILES)
94
95rpm:
96 make tgz
97 cp $(NAME)-$(VERSION).tgz /usr/src/RPM/SOURCES
98 rpm -ba rpm.spec
99 cp /usr/src/RPM/SRPMS/$(NAME)-$(VERSION)-1.src.rpm .
100 cp /usr/src/RPM/RPMS/i586/$(NAME)-$(VERSION)-1.i586.rpm .
101 scp *.rpm rsc@amsterdam.lcs.mit.edu:public_html/software
102
103PORTDIR=/usr/ports/$(PORTPLACE)
104
105ports:
106 make tgz
107 rm -rf $(PORTDIR)
108 mkdir $(PORTDIR)
109 cp $(NAME)-$(VERSION).tgz /usr/ports/distfiles
110 cat bundle.ports | (cd $(PORTDIR) && awk '$$1=="---" && $$3=="---" { ofile=$$2; next} {if(ofile) print >ofile}')
111 (cd $(PORTDIR); make makesum)
112 (cd $(PORTDIR); make)
113 (cd $(PORTDIR); /usr/local/bin/portlint)
114 rm -rf $(PORTDIR)/work
115 shar `find $(PORTDIR)` > ports.shar
116 (cd $(PORTDIR); tar cf - *) | gzip >$(NAME)-$(VERSION)-ports.tgz
117 scp *.tgz rsc@amsterdam.lcs.mit.edu:public_html/software
118
119.phony: all clean nuke install tgz rpm ports