1
2PACKAGE = o3read
3VERSION = 0.0.4
4
5CFLAGS += -Wall -ansi -pedantic
6BINDIR = $(PREFIX)/bin
7MANDIR = $(PREFIX)/man/man1
8DOCS = COPYING INSTALL README TODO ChangeLog filformat.sxw
9BINS = o3read o3totxt o3tohtml utf8tolatin1
10SRCS = o3read.h main.c o3read.c o3totxt.c o3tohtml.c utf8tolatin1.c
11MANS = o3read.1 o3tohtml.1 o3totxt.1 utf8tolatin1.1
12ARCH=`uname -s`-`uname -m`
13BINDISTDIR=/usr/local
14
15all: $(BINS)
16
17utf8tolatin1: utf8tolatin1.o
18	$(CC) -o utf8tolatin1 utf8tolatin1.o
19
20o3totxt: o3totxt.o o3read.o
21	$(CC) -o o3totxt o3totxt.o o3read.o
22
23o3tohtml: o3tohtml.o o3read.o
24	$(CC) -o o3tohtml o3tohtml.o o3read.o
25
26o3tosiag: o3tosiag.o o3read.o
27	$(CC) -o o3tosiag o3tosiag.o o3read.o
28
29o3read: main.o o3read.o
30	$(CC) -o o3read main.o o3read.o
31
32dist:
33	rm -rf $(PACKAGE)-$(VERSION)
34	mkdir $(PACKAGE)-$(VERSION)
35	cp Makefile $(DOCS) $(MANS) $(SRCS) $(PACKAGE)-$(VERSION)
36	tar cf - $(PACKAGE)-$(VERSION) | gzip > $(PACKAGE)-$(VERSION).tar.gz
37	rm -rf $(PACKAGE)-$(VERSION)
38
39strip: $(BINS)
40	strip $(BINS)
41
42install: $(BINS)
43	mkdir -p $(BINDIR) $(MANDIR)
44	cp $(BINS) $(BINDIR)
45	cp $(MANS) $(MANDIR)
46
47uninstall:
48	cd $(BINDIR) && rm -f $(BINS)
49	cd $(MANDIR) && rm -f $(MANS)
50
51clean:
52	rm -f *.o $(BINS) *~
53
54nstest:
55	unzip -p filformat.sxw content.xml|./o3tohtml|./utf8tolatin1>x.html
56	netscape ./x.html
57
58lytest:
59	unzip -p filformat.sxw content.xml|./o3tohtml|./utf8tolatin1>x.html
60	lynx ./x.html
61
62binaries:
63	rm -rf tmpinst
64	make clean strip install PREFIX=`cd . && pwd`/tmpinst$(BINDISTDIR)
65	(cd tmpinst && tar cf - .) | gzip > $(PACKAGE)-$(ARCH)-$(VERSION).tar.gz
66	rm -rf tmpinst
67
68tgz:
69	rm -rf tmpinst
70	make clean strip install PREFIX=`cd . && pwd`/tmpinst$(BINDISTDIR)
71	cd tmpinst && makepkg ../$(PACKAGE)-$(ARCH)-$(VERSION).tgz
72
73tgz2: binaries
74	rm -rf builddir
75	mkdir -p builddir
76	mkdir builddir/install
77	cp doinst.sh builddir/install
78	(cd builddir; \
79	tar zxf ../$(PACKAGE)-$(ARCH)-$(VERSION).tar.gz; \
80	tar zcf ../$(PACKAGE)-$(ARCH)-$(VERSION).tgz)
81	rm -rf builddir
82
83rpm: tgz
84	alien -r $(PACKAGE)-$(ARCH)-$(VERSION).tgz
85