Sat, 08 Mar 2003 07:23:49 +0000
added conditionals for debug builds and static linking.
1 # t2p: build a PDF file out of one or more TIFF Class F Group 4 files
2 # Makefile
3 # $Id: Makefile,v 1.19 2003/03/07 23:23:49 eric Exp $
4 # Copyright 2001, 2002, 2003 Eric Smith <eric@brouhaha.com>
5 #
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License version 2 as
8 # published by the Free Software Foundation. Note that permission is
9 # not granted to redistribute this program under the terms of any
10 # other version of the General Public License.
11 #
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA
23 DEBUG=1
24 # STATIC=1
27 CFLAGS = -Wall
28 LDFLAGS =
29 LDLIBS = -ltiff -ljpeg -lz -lm
31 ifdef DEBUG
32 CFLAGS := $(CFLAGS) -g
33 LDFLAGS := $(LDFLAGS) -g
34 LDLIBS := $(LDLIBS) -lefence -lpthread
35 endif
37 ifdef STATIC
38 LDLIBS := -Wl,-static $(LDLIBS)
39 endif
42 YACC = bison
43 YFLAGS = -d -v
46 # -----------------------------------------------------------------------------
47 # You shouldn't have to change anything below this point, but if you do please
48 # let me know why so I can improve this Makefile.
49 # -----------------------------------------------------------------------------
51 VERSION = 0.11
53 PACKAGE = t2p
55 TARGETS = t2p bitblt_test
57 CSRCS = t2p.c semantics.c \
58 bitblt.c bitblt_test.c bitblt_table_gen.c \
59 pdf_g4.c pdf_g4_table_gen.c \
60 pdf.c pdf_util.c pdf_prim.c pdf_bookmark.c pdf_name_tree.c
61 OSRCS = scanner.l parser.y
62 HDRS = t2p.h semantics.h bitblt.h \
63 pdf.h pdf_private.h pdf_util.h pdf_prim.h pdf_name_tree.h
64 MISC = COPYING Makefile
66 DISTFILES = $(MISC) $(HDRS) $(CSRCS) $(OSRCS)
67 DISTNAME = $(PACKAGE)-$(VERSION)
70 AUTO_CSRCS = scanner.c parser.tab.c
71 AUTO_HDRS = parser.tab.h bitblt_tables.h pdf_g4_tables.h
72 AUTO_MISC = parser.output
75 all: $(TARGETS)
78 t2p: t2p.o scanner.o semantics.o parser.tab.o bitblt.o \
79 pdf_g4.o \
80 pdf.o pdf_util.o pdf_prim.o pdf_bookmark.o pdf_name_tree.o
81 $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
82 ifndef DEBUG
83 strip $@
84 endif
87 bitblt_tables.h: bitblt_table_gen
88 ./bitblt_table_gen >bitblt_tables.h
90 bitblt_table_gen: bitblt_table_gen.o
92 bitblt_test: bitblt_test.o bitblt.o
94 pdf_g4_tables.h: pdf_g4_table_gen
95 ./pdf_g4_table_gen >pdf_g4_tables.h
97 pdf_g4_table_gen: pdf_g4_table_gen.o
100 dist: $(DISTFILES)
101 -rm -rf $(DISTNAME)
102 mkdir $(DISTNAME)
103 for f in $(DISTFILES); do ln $$f $(DISTNAME)/$$f; done
104 tar --gzip -chf $(DISTNAME).tar.gz $(DISTNAME)
105 -rm -rf $(DISTNAME)
108 clean:
109 rm -f *.o *.d $(TARGETS) $(AUTO_CSRCS) $(AUTO_HDRS) $(AUTO_MISC)
111 very_clean:
112 rm -f *.o *.d $(TARGETS) $(AUTO_CSRCS) $(AUTO_HDRS) $(AUTO_MISC) \
113 *~ *.pdf
115 wc:
116 wc -l $(HDRS) $(CSRCS) $(OSRCS) $(MISC)
118 ls-lt:
119 ls -lt $(HDRS) $(CSRCS) $(OSRCS) $(MISC)
122 %.tab.c %.tab.h %.output: %.y
123 $(YACC) $(YFLAGS) $<
126 ALL_CSRCS = $(CSRCS) $(AUTO_CSRCS)
128 DEPENDS = $(ALL_CSRCS:.c=.d)
130 %.d: %.c
131 $(CC) -M -MG $(CFLAGS) $< | sed -e 's@ /[^ ]*@@g' -e 's@^\(.*\)\.o:@\1.d \1.o:@' > $@
133 include $(DEPENDS)