Makefile

Thu, 10 Apr 2003 09:02:12 +0000

author
eric
date
Thu, 10 Apr 2003 09:02:12 +0000
changeset 158
e5452e27f518
parent 157
160d624271cc
child 160
1f793b71ffff
permissions
-rw-r--r--

include tumble version in usage message.

eric@125 1 # tumble: build a PDF file from image files
eric@1 2 # Makefile
eric@158 3 # $Id: Makefile,v 1.41 2003/04/10 01:02:12 eric Exp $
eric@80 4 # Copyright 2001, 2002, 2003 Eric Smith <eric@brouhaha.com>
eric@1 5 #
eric@1 6 # This program is free software; you can redistribute it and/or modify
eric@1 7 # it under the terms of the GNU General Public License version 2 as
eric@1 8 # published by the Free Software Foundation. Note that permission is
eric@1 9 # not granted to redistribute this program under the terms of any
eric@1 10 # other version of the General Public License.
eric@1 11 #
eric@1 12 # This program is distributed in the hope that it will be useful,
eric@1 13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
eric@1 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
eric@1 15 # GNU General Public License for more details.
eric@1 16 #
eric@1 17 # You should have received a copy of the GNU General Public License
eric@1 18 # along with this program; if not, write to the Free Software
eric@1 19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA
eric@1 20
eric@1 21
eric@90 22 # Conditionals: uncomment the following defines as nessary. Note that a
eric@90 23 # "0" value is considered true by make, so to disable conditionals comment
eric@90 24 # them out or set them to a null string.
eric@86 25
eric@143 26 #DEBUG=1
eric@90 27 #EFENCE=1
eric@90 28 #STATIC=1
eric@86 29
eric@86 30
eric@86 31 CFLAGS = -Wall
eric@86 32 LDFLAGS =
eric@157 33 LDLIBS = -ltiff -ljpeg -lpbm -lz -lm
eric@53 34
eric@86 35 ifdef DEBUG
eric@86 36 CFLAGS := $(CFLAGS) -g
eric@86 37 LDFLAGS := $(LDFLAGS) -g
eric@136 38 else
eric@136 39 CFLAGS := $(CFLAGS) -O3
eric@90 40 endif
eric@90 41
eric@90 42 ifdef EFENCE
eric@86 43 LDLIBS := $(LDLIBS) -lefence -lpthread
eric@86 44 endif
eric@53 45
eric@86 46 ifdef STATIC
eric@86 47 LDLIBS := -Wl,-static $(LDLIBS)
eric@86 48 endif
eric@86 49
eric@53 50
eric@6 51 YACC = bison
eric@6 52 YFLAGS = -d -v
eric@6 53
eric@53 54
eric@51 55 # -----------------------------------------------------------------------------
eric@51 56 # You shouldn't have to change anything below this point, but if you do please
eric@51 57 # let me know why so I can improve this Makefile.
eric@51 58 # -----------------------------------------------------------------------------
eric@51 59
eric@157 60 VERSION = 0.33
eric@51 61
eric@125 62 PACKAGE = tumble
eric@12 63
eric@125 64 TARGETS = tumble
eric@15 65
eric@125 66 CSRCS = tumble.c semantics.c \
eric@157 67 tumble_input.c tumble_tiff.c tumble_jpeg.c tumble_pbm.c \
eric@91 68 bitblt.c bitblt_table_gen.c bitblt_g4.c g4_table_gen.c \
eric@131 69 pdf.c pdf_util.c pdf_prim.c pdf_name_tree.c \
eric@131 70 pdf_bookmark.c pdf_page_label.c \
eric@119 71 pdf_text.c pdf_g4.c pdf_jpeg.c
eric@51 72 OSRCS = scanner.l parser.y
eric@141 73 HDRS = tumble.h tumble_input.h semantics.h bitblt.h bitblt_tables.h \
eric@80 74 pdf.h pdf_private.h pdf_util.h pdf_prim.h pdf_name_tree.h
eric@136 75 MISC = COPYING README INSTALL Makefile
eric@51 76
eric@51 77 DISTFILES = $(MISC) $(HDRS) $(CSRCS) $(OSRCS)
eric@51 78 DISTNAME = $(PACKAGE)-$(VERSION)
eric@51 79
eric@138 80 BIN_DISTFILES = COPYING README $(TARGETS)
eric@138 81
eric@51 82
eric@99 83 AUTO_CSRCS = scanner.c parser.tab.c bitblt_tables.c g4_tables.c
eric@99 84 AUTO_HDRS = parser.tab.h bitblt_tables.h g4_tables.h
eric@99 85 AUTO_MISC = parser.output
eric@15 86
eric@51 87
eric@158 88 CFLAGS := $(CFLAGS) -DTUMBLE_VERSION=$(VERSION)
eric@158 89
eric@158 90
eric@90 91 -include Maketest
eric@90 92
eric@90 93
eric@90 94 all: $(TARGETS) $(TEST_TARGETS)
eric@51 95
eric@51 96
eric@141 97 tumble: tumble.o semantics.o \
eric@157 98 tumble_input.o tumble_tiff.o tumble_jpeg.o tumble_pbm.o \
eric@141 99 scanner.o parser.tab.o \
eric@99 100 bitblt.o bitblt_g4.o bitblt_tables.o g4_tables.o \
eric@131 101 pdf.o pdf_util.o pdf_prim.o pdf_name_tree.o \
eric@131 102 pdf_bookmark.o pdf_page_label.o \
eric@119 103 pdf_text.o pdf_g4.o pdf_jpeg.o
eric@86 104 $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
eric@86 105 ifndef DEBUG
eric@86 106 strip $@
eric@86 107 endif
eric@86 108
eric@53 109
eric@53 110 bitblt_tables.h: bitblt_table_gen
eric@97 111 ./bitblt_table_gen -h >bitblt_tables.h
eric@97 112
eric@97 113 bitblt_tables.c: bitblt_table_gen
eric@97 114 ./bitblt_table_gen -c >bitblt_tables.c
eric@53 115
eric@53 116 bitblt_table_gen: bitblt_table_gen.o
eric@53 117
eric@91 118 g4_tables.h: g4_table_gen
eric@99 119 ./g4_table_gen -h >g4_tables.h
eric@99 120
eric@99 121 g4_tables.c: g4_table_gen
eric@99 122 ./g4_table_gen -c >g4_tables.c
eric@71 123
eric@91 124 g4_table_gen: g4_table_gen.o
eric@71 125
eric@53 126
eric@51 127 dist: $(DISTFILES)
eric@51 128 -rm -rf $(DISTNAME)
eric@51 129 mkdir $(DISTNAME)
eric@51 130 for f in $(DISTFILES); do ln $$f $(DISTNAME)/$$f; done
eric@51 131 tar --gzip -chf $(DISTNAME).tar.gz $(DISTNAME)
eric@51 132 -rm -rf $(DISTNAME)
eric@51 133
eric@51 134
eric@126 135 rh-rel := $(shell sed 's/^Red Hat Linux release \([0-9][0-9]*\.[0-9][0-9]*\) (.*)/\1/' </etc/redhat-release)
eric@126 136
eric@138 137 bin-dist-rh: $(BIN_DISTFILES) /etc/redhat-release
eric@138 138 tar --gzip -chf $(DISTNAME)-rh${rh-rel}.tar.gz $(BIN_DISTFILES)
eric@126 139
eric@126 140
eric@15 141 clean:
eric@53 142 rm -f *.o *.d $(TARGETS) $(AUTO_CSRCS) $(AUTO_HDRS) $(AUTO_MISC)
eric@44 143
eric@44 144 very_clean:
eric@53 145 rm -f *.o *.d $(TARGETS) $(AUTO_CSRCS) $(AUTO_HDRS) $(AUTO_MISC) \
eric@44 146 *~ *.pdf
eric@15 147
eric@20 148 wc:
eric@51 149 wc -l $(HDRS) $(CSRCS) $(OSRCS) $(MISC)
eric@20 150
eric@20 151 ls-lt:
eric@51 152 ls -lt $(HDRS) $(CSRCS) $(OSRCS) $(MISC)
eric@20 153
eric@15 154
eric@15 155 %.tab.c %.tab.h %.output: %.y
eric@6 156 $(YACC) $(YFLAGS) $<
eric@6 157
eric@15 158
eric@90 159 ALL_CSRCS = $(CSRCS) $(AUTO_CSRCS) $(TEST_CSRCS)
eric@15 160
eric@51 161 DEPENDS = $(ALL_CSRCS:.c=.d)
eric@15 162
eric@15 163 %.d: %.c
eric@15 164 $(CC) -M -MG $(CFLAGS) $< | sed -e 's@ /[^ ]*@@g' -e 's@^\(.*\)\.o:@\1.d \1.o:@' > $@
eric@15 165
eric@15 166 include $(DEPENDS)