1# 2# type "make help" for help 3# 4# TODO: examples 5# add rpm to dist package, man page 6# 7# Changes: 8# - be sure that configure is called after untgz, tar original file attributes 9# - suggestion of Marcel Pol 6Dec2001: 10# make install DESTDIR=$RPM_BUILD_ROOT 11# 12 13prefix = /usr/local 14#bindir = $(prefix)/bin 15bindir = /usr/local${exec_prefix}/bin 16 17SHELL = /bin/sh 18# this does not work on SuSE 6.0, why? (autoconf 2.12 do not set /bin/sh ?) 19#SHELL = bash # 20INSTALL = /usr/bin/install -c 21CC = gcc 22CFLAGS = -g -O2 23# following DEFs are not used, but I play with it for training 24CPPFLAGS = -Wall -g -fexceptions -DDO_DEBUG=1 25DEFS = -DHAVE_CONFIG_H 26includedir = ${prefix}/include 27# 28# -pedantic -ansi -Wall 29LDFLAGS = -lm 30LIBS = 31 32# RANLIB = @RANLIB@ 33# AR = @AR@ 34 35 36# files for devel.tgz 37FILES = \ 38 AUTHORS Makefile Makefile.in bin/ doc/ include/ examples/ man/ src/\ 39 BUGS README make.bat CREDITS READMEde.txt REMARK.txt\ 40 HISTORY REVIEW configure gpl.html INSTALL TODO configure.in\ 41 install-sh gocr.spec .cvsignore 42 43# files for distribution 44AFILES = $(FILES) lib/ 45 46DIRS = doc/ include/ man/ examples/ bin/ src/ lib/ 47 48# export all make-variables to submakes - said to be not working on IRIS 49 50# default rule 51default: all 52 53.PHONY : src doc examples help clean proper distclean dist tgz rpm libs 54 55# example file generation takes lot of memory and time, do it explicitely 56# by make examples 57all: src Makefile 58 @echo " --- for help do: make help" 59 @echo " --- for documentation do: make doc" 60 @echo " --- for examples do: make examples" 61 @echo " --- for testing do: bin/gocr_chk.sh [testbasedir?=.]" 62 63include/config.h: include/config.h.in configure 64 ./configure 65 66configure: configure.in 67 autoconf 68 69src/Makefile Makefile: Makefile.in src/Makefile.in configure 70 ./configure --with-debug 71 72#src/Makefile: src/Makefile.in configure 73# ./configure 74 75src: src/Makefile 76 $(MAKE) -C src all 77 78libs: src/Makefile 79 $(MAKE) -C src libs 80 81man: 82 $(MAKE) -C man all 83 84doc: 85 $(MAKE) -C doc all 86 87examples: 88 $(MAKE) -C examples all 89 90help: 91 @printf "make - compile all\n" 92 @printf "make libs - compile libraries libPgm2asc.{a,so}\n" 93 @printf "make src - build lib and gocr\n" 94 @printf "make man - build manual\n" 95 @printf "make doc - make documentation\n" 96 @printf "make examples - create examples ./examples/\n" 97 @printf "make clean - erase temporary files\n" 98 @printf "make proper - erase all created files\n" 99 @printf "make install - Really? Its development version!\n" 100 @printf "make uninstall - remove installed files from the system\n" 101 102 103# you can override this variable by: make install DESTDIR=yourpath 104DESTDIR=/usr/local 105.PHONY : install uninstall test examples 106install: 107 $(MAKE) -C src install 108 $(MAKE) -C man install 109 # following steps are not needed for end users, but cost dependencies 110 # therefore removed in 0.48 111 # $(MAKE) -C doc install 112 # $(MAKE) -C examples install 113 # $(MAKE) -C frontend install 114 115uninstall: 116 $(MAKE) -C src uninstall 117 $(MAKE) -C man uninstall 118 # $(MAKE) -C doc uninstall 119 # $(MAKE) -C examples uninstall 120 # $(MAKE) -C frontend uninstall 121 122# generate version file before packaging (most up to date) 123# release is the date of the last modified src file (for bug reports) 124# to distinguish different developper versions of same version number 125include/version.h: src/*.[ch] Makefile 126 echo "/* WARNING: this file is autogenerated by Makefile */" > $@ 127 echo "/* edit configure.in to set a new version number */" >> $@ 128 echo "#define version_string \"0.52\"" >> $@ 129 echo "#define release_string \"`date +%Y%m%d`\"" >> $@ 130 131dist: include/version.h 132 echo gocr-0.52 > .fname 133 -rm -rf `cat .fname` 134 mkdir `cat .fname` 135 # create subdirs, because cp -r bin/gocr.tcl jocr => jocr/gocr.tcl 136 (cd `cat .fname`; mkdir $(DIRS)) 137 cp -r -p -d $(AFILES) `cat .fname` 138 $(MAKE) -C `cat .fname` proper 139 # for Win, DOS and Mac no configure available, reset config.h 140 cp `cat .fname`/include/config.h.in `cat .fname`/include/config.h 141 touch `cat .fname`/configure # Makefile will be updated 142 tar chzf ../`cat .fname`.tar.gz `cat .fname` 143 # avoid popping up x11-gpg-agent: DISPLAY="" 144 -DISPLAY="" gpg -ab --default-key 0x53BDFBE3 ../`cat .fname`.tar.gz # .asc 145 ls -l ../`cat .fname`.tar.gz{,.asc} 146 -rm -rf `cat .fname` .fname 147 148 149# the tgz-option is only for the author, to carry the sources home 150tgz: include/version.h 151 mkdir jocr # causes an error if exist 152 # create subdirs, because cp -r bin/gocr.tcl jocr => jocr/gocr.tcl 153 (cd jocr; mkdir $(DIRS)) 154 -cp -rup -d $(FILES) CVS jocr 155 $(MAKE) -C jocr proper 156 if test -d jocr/src/api; then echo "--- rm -r jocr/src/api ---"; fi 157 -rm -rf jocr/src/api 158 # -rm -rf jocr/CVS jocr/*/CVS jocr/*/*/CVS # CVS tree 159 -rm -rf jocr/Makefile jocr/src/Makefile jocr/include/config.h 160 tar chzf ../jocr.tgz jocr 161 # avoid popping up x11-gpg-agent 162 -DISPLAY="" gpg -ab --default-key 0x53BDFBE3 ../jocr.tgz # .asc 163 -cp ../jocr.tgz ../jocr.tgz.`date +%y%m%d` # backup, remove later 164 ls -l ../jocr.tgz{,.asc} 165 -rm -rf jocr 166 167# the rpm option is for the author, to create simple rpm packages 168TRPM = $(HOME)/tmp_gocr_build 169# only gocr? 170#VERSION=$(shell sed -e '/version_string/!d' -e 's/[^0-9.]*\([0-9.]*\).*/\1/' -e q src/gocr.c) 171rpm: 172 echo "%_topdir $(TRPM)" > ~/.rpmmacros 173 mkdir -p $(TRPM)/{SOURCES,SPECS,BUILD,RPMS,SRPMS} 174 sed "s/version.*[0-9]\.[0-9]*/version 0.52/"\ 175 gocr.spec >$(TRPM)/SPECS/gocr.spec 176 cp ../gocr-0.52.tar.gz $(TRPM)/SOURCES 177 #rpmbuild -ba --nobuild gocr.spec # bin+src-rpm 178 (cd $(TRPM)/SPECS; rpmbuild -bb gocr.spec) 179 rpm -qil -p $(TRPM)/RPMS/i?86/gocr-0.52-*.i?86.rpm 180 181# PHONY = don't look at file clean, -rm = start rm and ignore errors 182.PHONY : clean proper 183clean: 184 -rm -f config.cache config.status config.log 185 -rm -f *.aux *.log *.dvi *.ps *.lj *~ gocr.ini out.txt 186 -rm -f convert.cc convert convert.o # remove v0.2.4 rests 187 $(MAKE) -C src clean 188 $(MAKE) -C doc clean 189 $(MAKE) -C examples/ clean 190 191 192distclean: proper 193 194proper: clean 195 $(MAKE) -C src/ proper 196 $(MAKE) -C doc proper 197 $(MAKE) -C examples/ proper 198 -rm -f gocr bin/gocr libPgm2asc.* out[0-9][0-9].{bmp,png} 199