2 UNAME_S
:= $(shell uname
-s
2>/dev
/null || echo unknown
)
3 UNAME_O
:= $(shell uname
-o
2>/dev
/null || echo unknown
)
6 CFLAGS
= -O0
-g
-Wextra
-DMEMDEBUG
-DSTRBUF_CHECK
20 CFLAGS
+= -DUSE_KUNZIP
21 ZIP_OBJS
= kunzip
/fileio.o kunzip
/zipfile.o
26 OBJ
= odt2txt.o regex.o mem.o strbuf.o
$(ZIP_OBJS
)
27 TEST_OBJ
= t
/test-strbuf.o t
/test-regex.o
28 ALL_OBJ
= $(OBJ
) $(TEST_OBJ
)
35 BINDIR
= $(PREFIX
)/bin
36 MANDIR
= $(PREFIX
)/share
/man
37 MAN1DIR
= $(MANDIR
)/man1
39 ifeq ($(UNAME_S
),FreeBSD
)
40 CFLAGS
+= -DICONV_CHAR
="const char" -I
/usr
/local
/include
41 LDFLAGS
+= -L
/usr
/local
/lib
44 ifeq ($(UNAME_S
),OpenBSD
)
45 CFLAGS
+= -DICONV_CHAR
="const char" -I
/usr
/local
/include
46 LDFLAGS
+= -L
/usr
/local
/lib
49 ifeq ($(UNAME_S
),Darwin
)
50 CFLAGS
+= -I
/opt
/local
/include
51 LDFLAGS
+= -L
/opt
/local
/lib
54 ifeq ($(UNAME_S
),NetBSD
)
55 CFLAGS
+= -DICONV_CHAR
="const char"
57 ifeq ($(UNAME_S
),SunOS
)
60 CFLAGS
= -v
-g
-DMEMDEBUG
-DSTRBUF_CHECK
65 CFLAGS
+= -DICONV_CHAR
="const char"
67 ifeq ($(UNAME_S
),HP-UX
)
68 CFLAGS
+= -I
$(ZLIB_DIR
)
69 LIBS
= $(ZLIB_DIR
)/libz.a
71 ifeq ($(UNAME_O
),Cygwin
)
72 CFLAGS
+= -DICONV_CHAR
="const char"
76 ifeq ($(UNAME_O
),Msys
)
77 CFLAGS
+= -I
/mingw
$(ARCH
)/lib
/libzip
/include
78 LIBS
+= -liconv
-llibzip
-lzip
-lz
-L
/mingw
$(ARCH
)/lib
82 CFLAGS
+= -I
$(REGEX_DIR
) -I
$(ZLIB_DIR
) -I
$(ICONV_DIR
)/include/ -I
$(LIBZIP_DIR
)/lib
/
83 LIBS
= $(REGEX_DIR
)/regex.o
85 CFLAGS
+= -DZIP_STATIC
86 LIBS
+= $(wildcard $(ICONV_DIR
)/lib
/.libs
/*.o
)
87 LIBS
+= $(LIBZIP_DIR
)/lib
/.libs
/libzip.a
88 LIBS
+= $(ZLIB_DIR
)/libz.a
99 $(CC
) -o
$@
$(LDFLAGS
) $(OBJ
) $(LIBS
)
101 t
/test-strbuf
: t
/test-strbuf.o strbuf.o mem.o
102 t
/test-regex
: t
/test-regex.o regex.o strbuf.o mem.o
107 @if
[ -n
"$(USE_KUNZIP)" ] ; then \
109 echo
' Please use libzip (http://www.nih.at/libzip) instead of' ; \
110 echo
' kunzip. It is a much more complete zip library and has' ; \
111 echo
' much better handling for exotic and/or broken documents.' ; \
115 install: $(BIN
) $(MAN
)
116 $(INSTALL
) -d
-m755
$(DESTDIR
)$(BINDIR
)
117 $(INSTALL
) $(BIN
) $(DESTDIR
)$(BINDIR
)
118 $(INSTALL
) -d
-m755
$(DESTDIR
)$(MAN1DIR
)
119 $(INSTALL
) $(MAN
) $(DESTDIR
)$(MAN1DIR
)
122 $(GROFF
) -Thtml
-man
$(MAN
) > $@
125 $(GROFF
) -Tps
-man
$(MAN
) > $@
128 rm -fr
$(OBJ
) $(BIN
) odt2txt.ps odt2txt.html