Alexander Gutkin | 439f3d1 | 2014-02-28 11:33:45 +0000 | [diff] [blame] | 1 | |
| 2 | # this works in gnu make |
| 3 | SYSNAME:=${shell uname} |
| 4 | OBJTYPE:=${shell uname -m | sed 's;i.86;386;; s;/.*;;; s; ;;g'} |
| 5 | |
| 6 | # this works in bsd make |
| 7 | SYSNAME!=uname |
| 8 | OBJTYPE!=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 | |
| 13 | RANLIB=true |
| 14 | |
| 15 | include Make.$(SYSNAME)-$(OBJTYPE) |
| 16 | |
| 17 | PREFIX=/usr/local |
| 18 | |
| 19 | NUKEFILES= |
| 20 | |
| 21 | TGZFILES= |
| 22 | |
| 23 | CLEANFILES= |
| 24 | |
| 25 | LIB=libutf.a |
| 26 | VERSION=2.0 |
| 27 | PORTPLACE=devel/libutf |
| 28 | NAME=libutf |
| 29 | |
| 30 | OFILES=\ |
| 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 | |
| 52 | HFILES=\ |
| 53 | utf.h\ |
| 54 | |
| 55 | all: $(LIB) |
| 56 | |
| 57 | install: $(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 | |
| 72 | NUKEFILES+=$(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 | |
| 82 | tgz: |
| 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 | |
| 89 | clean: |
| 90 | rm -f $(OFILES) $(LIB) $(CLEANFILES) |
| 91 | |
| 92 | nuke: |
| 93 | rm -f $(OFILES) *.tgz *.rpm $(NUKEFILES) |
| 94 | |
| 95 | rpm: |
| 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 | |
| 103 | PORTDIR=/usr/ports/$(PORTPLACE) |
| 104 | |
| 105 | ports: |
| 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 |