1# Makefile for xv 2 3# your C compiler (and options) of choice 4CC = cc 5#CC = gcc -ansi 6# note that -ansi kills __USE_MISC (gcc 2.95.3), which, at least on Linux, 7# determines whether stdlib.h includes prototypes for mktemp(), random(), etc. 8# (i.e., if you use it, you will get unnecessary compiler warnings) 9#CC = gcc 10 11# use this if you're using 'cc' on a DEC Alpha (OSF/1) or MIPS (Ultrix) system: 12# CC = cc -std1 -Olimit 750 13 14# this is what I personally use on an OSF Alpha. Not that I recommend it. 15# CC = gcc -g -ansi -pedantic -W -Wreturn-type -Wmissing-prototypes \ 16# -Wstrict-prototypes -Waggregate-return -Wconversion \ 17# -Wpointer-arith -Wcomment -Wformat -Wchar-subscripts \ 18# -Wuninitialized -Wparentheses 19 20 21CCOPTS = -O 22# 23# these are the usual optimization and warning options for gcc; all such 24# warnings but one (mktemp() use) have been eliminated (at least on Linux): 25#CCOPTS = -O3 -Wall 26# 27# slightly more warnings... older code often made non-const pointers to 28# static strings (nothing should blow up unless something tries to write 29# to them): 30#CCOPTS = -O3 -Wall -Wpointer-arith -Wcast-align -Wwrite-strings -Wnested-externs 31# 32# for the next step up in gcc noise, try adding -W (but note that it adds a 33# huge number of unused-parameter and signed/unsigned comparison warnings): 34#CCOPTS = -O3 -Wall -W 35 36### NOTE: Sun running OpenWindows: 37### if you're using a SUN running OPENWINDOWS, you need to add these two 38### options to the CCOPTS line, so it finds the libs and include files 39### -L/usr/openwin/lib -I/usr/openwin/include 40### 41### In general, if your X11 include files and libX11.a library aren't in the 42### 'standard' places in which the C compiler looks, you should add '-L' and 43### '-I' options on the CCOPTS line to tell the compiler where said files are. 44 45 46# older Unixen don't support the -p option, but its lack may mean installation 47# will fail (if more than one directory level is missing) 48MKDIR = mkdir -p 49 50 51# BeOS _may_ need to use a different version (below), but probably not 52CLEANDIR = cleandir 53 54 55### Installation locations 56### NOTE: Users of old K&R compilers (i.e., any version not supporting C89 57### string concatenation, such as "fub" "ar" => "fubar") should update 58### xvtext.c:1831 (or thereabouts) if either PREFIX or DOCDIR changes: 59PREFIX = /usr/local 60BINDIR = $(PREFIX)/bin 61MANDIR = $(PREFIX)/share/man/man1 62MANSUF = 1 63DOCDIR = $(PREFIX)/share/doc/xv 64LIBDIR = $(PREFIX)/lib/xv 65SYSCONFDIR = /etc 66DESTDIR = 67 68 69buildit: all 70 71 72########################### CONFIGURATION OPTIONS ############################ 73### NOTE: be sure to check 'config.h', for a few other configuration options 74############################################################################## 75 76### 77### if, for whatever reason, you're unable to get the TIFF library to compile 78### on your machine, *COMMENT OUT* the following lines 79### 80### GRR 20050319: USE_TILED_TIFF_BOTLEFT_FIX enables an experimental fix for 81### tiled TIFFs with ORIENTATION_BOTLEFT. It may break other tiled TIFFs, 82### or it may be required for certain other TIFF types (e.g., strips with 83### ORIENTATION_BOTLEFT). I don't have a sufficient variety of TIFF test 84### images at hand. 85### 86#TIFF = -DDOTIFF 87TIFF = -DDOTIFF -DUSE_TILED_TIFF_BOTLEFT_FIX 88### 89#TIFFDIR = tiff 90TIFFDIR = /usr 91#TIFFDIR = /usr/local 92#TIFFDIR = ../../libtiff 93### 94TIFFINC = -I$(TIFFDIR)/include 95#TIFFINC = -I$(TIFFDIR) 96### 97### libtiff 3.5 and up may be compiled with zlib and libjpeg, but the 98### dependency is properly handled in LIBS line ~247 lines below 99### 100TIFFLIB = -L$(TIFFDIR)/lib -ltiff 101#TIFFLIB = $(TIFFDIR)/lib/libtiff.a 102#TIFFLIB = -L$(TIFFDIR) -ltiff 103#TIFFLIB = $(TIFFDIR)/libtiff.a 104### 105### this is intended to build the ancient version (3.3.016 beta) that's 106### included in the "tiff" subdir of XV, not an arbitrary copy of libtiff: 107### 108#$(TIFFLIB): 109# ( cd $(TIFFDIR) ; make CC='$(CC)' COPTS='$(CCOPTS) $(MCHN)' ) 110 111 112### 113### if, for whatever reason, you're unable to get the JPEG library to compile 114### on your machine, *COMMENT OUT* the following lines 115### 116### NOTE: /usr/sfw can be used on Solaris with "Sun freeware" installed 117### 118JPEG = -DDOJPEG 119#JPEGDIR = jpeg 120JPEGDIR = /usr 121#JPEGDIR = /usr/local 122#JPEGDIR = ../../libjpeg 123#JPEGDIR = /usr/sfw 124### 125JPEGINC = -I$(JPEGDIR)/include 126#JPEGINC = -I$(JPEGDIR) 127### 128JPEGLIB = -L$(JPEGDIR)/lib -ljpeg 129#JPEGLIB = -L$(JPEGDIR) -ljpeg 130#JPEGLIB = $(JPEGDIR)/libjpeg.a 131### 132### this is intended to build the ancient version (5a) that's included in the 133### "jpeg" subdir of XV, not an arbitrary copy of libjpeg: 134### 135#$(JPEGDIR)/jconfig.h: 136# cd $(JPEGDIR) ; ./configure CC='$(CC)' 137#$(JPEGLIB): $(JPEGDIR)/jconfig.h 138# cd $(JPEGDIR) ; make 139 140 141### 142### if, for whatever reason, you're unable to get the PNG library to compile 143### on your machine, *COMMENT OUT* the following lines 144### 145PNG = -DDOPNG 146PNGDIR = /usr 147#PNGDIR = /usr/local 148#PNGDIR = ../../libpng 149### 150PNGINC = -I$(PNGDIR)/include 151#PNGINC = -I$(PNGDIR) 152### 153PNGLIB = -L$(PNGDIR)/lib -lpng 154#PNGLIB = -L$(PNGDIR) -lpng 155#PNGLIB = $(PNGDIR)/libpng.a 156 157 158### 159### if, for whatever reason, you're unable to get both the PNG library and 160### (newer versions of) the TIFF library to compile on your machine, *COMMENT 161### OUT* the following lines 162### 163ZLIBDIR = /usr 164#ZLIBDIR = /usr/local 165#ZLIBDIR = ../../zlib 166### 167ZLIBINC = -I$(ZLIBDIR)/include 168#ZLIBINC = -I$(ZLIBDIR) 169### 170ZLIBLIB = -L$(ZLIBDIR)/lib -lz 171#ZLIBLIB = -L$(ZLIBDIR) -lz 172#ZLIBLIB = $(ZLIBDIR)/libz.a 173 174 175### 176### if, for whatever reason, you're unable to get the JasPer JPEG-2000 library 177### to compile on your machine, *COMMENT OUT* the following lines 178### 179JP2K = -DDOJP2K 180### 181#JP2KDIR = ../../jasper 182JP2KDIR = /usr/local/lib 183### 184#JP2KINC = -I$(JP2KDIR) 185JP2KINC = -I/usr/local/include 186### 187#JP2KLIB = -L$(JP2KDIR) -ljasper 188JP2KLIB = $(JP2KDIR)/libjasper.a 189 190 191### 192### if, for whatever reason, you're unable to get the PDS/VICAR support 193### to compile (xvpds.c, and vdcomp.c), *COMMENT OUT* the following line, 194### and also remove 'vdcomp' from the 'all:' dependency 195### 196PDS = -DDOPDS 197 198 199#----------System V---------- 200 201# if you are running on a SysV-based machine, such as HP, Silicon Graphics, 202# Solaris, etc.; uncomment one of the following lines to get you *most* of 203# the way there. SYSV means System V R3. 204# UNIX = -DSVR4 205# UNIX = -DSYSV 206 207 208#----------Machine-Specific Configurations---------- 209 210### If you are using a BeOS system, uncomment the following line 211#MCHN = -DUSE_GETCWD -I/usr/X11/include -L/usr/X11/lib 212### 213### The stock version of cleandir now should work for BeOS, too, so try 214### leaving this commented out: 215#CLEANDIR = cleandir.BeOS 216 217 218### If you are using an SGI system, uncomment the following line 219#MCHN = -Dsgi 220 221 222### For HP-UX, uncomment the following line 223#MCHN= -Dhpux -D_HPUX_SOURCE 224# To use old HP compilers (HPUX 7.0 or so), you may need 225#MCHN= -Dhpux -D_HPUX_SOURCE +Ns4000 226# 227# Also, if you're using HP's compiler, add '-Aa' to whichever of those 228# two lines you're using, to turn on ANSI C mode. Or so I'm told. 229# 230# Note: You may need to add '-I/usr/include/X11R5' (or R6, or whatever) 231# to whichever of those lines you used, as HP tends to store their X11 232# include files in a non-standard place... 233# 234# And you probably have to add '-lV3' to the end of the LIBS def when 235# using XV's AUTO_EXPAND option. 236 237 238### for Linux, uncomment one of the following lines: 239#MCHN = -DLINUX -L/usr/X11R6/lib 240#MCHN = -DLINUX -L/usr/X11R6/lib64 241 242 243# For SCO 1.1 (UNIX 3.2v2) machines, uncomment the following: 244#MCHN = -Dsco -DPOSIX 245# 246# For ODT 2.0 (UNIX 3.2v4) machines, uncomment the following: 247#MCHN= -Dsco -DPOSIX -DNO_RANDOM 248# 249# Also, you should add '-lc -lx' to the end of the LIBS def below 250# -lx must be after -lc so you get the right directory routines. 251 252 253# for UMAX V by Encore Computers uncomment the following line for 254# the portable C compiler, system-specific definitions and 255# location of local X11 library (if site-specific, modify -L option) 256# No other switches should be necessary, or so I'm told... 257# 258#MCHN = -q extensions=pcc_c -D__UMAXV__ -L/usr2/usr/lib/X11 -DSVR4 259 260# For Interactive/SunSoft Unix ISC 4.0 (whatever *that* is!) 261#MCHN = -DSVR4 -DBSDTYPES 262 263 264#----------'Roll Your Own' Options---------- 265 266 267# if your machine doesn't have 'random()', but does have 'rand()', 268# uncomment the following line: 269# 270#RAND = -DNO_RANDOM 271 272 273# if your system *doesn't* have /usr/include/dirent.h, (ie, isn't POSIX 274# compliant, then you may have to uncomment the following line to use the 275# 'old-style' directory-handling structures 276# 277#NODIRENT = -DNODIRENT 278 279 280# if your machine has the usleep() function, uncomment the following line: 281# if it doesn't, or you're not sure, leave this line alone. 282#TIMERS = -DUSLEEP 283 284 285# if XV locks up whenever you click on *any* of the buttons, the Timer() 286# function in xvmisc.c is going out to lunch. A simple workaround is to 287# uncomment the following line: 288#TIMERS = -DNOTIMER 289 290 291# if you are running under DXWM, I pity you. XV doesn't work correctly 292# under DXWM. You should probably be running MWM. However, if such is 293# not an option for you, try uncommenting the following line. The 294# behavior won't be 'right', but it will be less 'wrong'. 295#DXWM = -DDXWM 296 297 298# if, during compilation, your system complains about the types 299# 'u_long', 'u_short', 'u_int', etc. as being undefined, uncomment the 300# following line: 301#BSDTYPES = -DBSDTYPES 302 303 304# if your machine doesn't have 'vprintf()' or 'vsprintf()' 305# (see vprintf.c for more information, if needed) 306# 307# (for BSD 4.3 VAX, uncomment the following line) 308#VPRINTF = -DNEED_VPRINTF -DINTSPRINTF -DLONGINT -DNOVOID 309# (for (stock) IBM RT AOS 4.3, uncomment the following line) 310#VPRINTF = -DNEED_VPRINTF -DLONGINT -DNOSTDHDRS 311# (for Sequent running DYNIX 3.1.4, uncomment the following line) 312#VPRINTF = -DNEED_VPRINTF -DLONGINT -DNOSTDHDRS 313 314 315# if your machine puts the prototype for 'malloc()' in malloc.h rather than 316# stdlib.h, uncomment the following line: 317# 318#MALLOC = -DNEED_MALLOC_H 319 320 321# if your X Window System compiled with -DX_LOCALE, 322# uncomment the following line: 323# TVL10N = -DX_LOCALE 324 325# Install directory of xv_mgcsfx.sample. 326MGCSFXDIR = $(LIBDIR) 327# Directory of default configuration file. 328MGCSFX = -DMGCSFXDIR=\"$(MGCSFXDIR)\" 329 330 331 332 333################ END OF CONFIGURATION OPTIONS ################# 334 335 336 337 338CFLAGS = $(CCOPTS) $(PNG) $(PNGINC) $(ZLIBINC) $(JPEG) $(JPEGINC) \ 339 $(TIFF) $(TIFFINC) $(PDS) $(JP2K) $(JP2KINC) $(TVL10N) $(MGCSFX) \ 340 $(UNIX) $(BSDTYPES) $(RAND) $(MALLOC) $(DXWM) $(MCHN) $(NODIRENT) \ 341 $(VPRINTF) $(TIMERS) -DDOCDIR=\"$(DOCDIR)\" \ 342 -DSYSCONFDIR=\"$(SYSCONFDIR)\" -DXVEXECPATH=\"$(LIBDIR)\" 343 344### remove -lm for BeOS: 345LIBS = $(TIFFLIB) $(JPEGLIB) $(PNGLIB) $(ZLIBLIB) $(JP2KLIB) -L/usr/X11R6/lib -lX11 -lm 346#LIBS = $(TIFFLIB) $(JPEGLIB) $(PNGLIB) $(ZLIBLIB) $(JP2KLIB) -lX11 347 348OBJS = xv.o xvevent.o xvroot.o xvmisc.o xvimage.o xvcolor.o xvsmooth.o \ 349 xv24to8.o xvgif.o xvpm.o xvinfo.o xvctrl.o xvscrl.o xvalg.o \ 350 xvgifwr.o xvdir.o xvbutt.o xvpbm.o xvxbm.o xvgam.o xvbmp.o \ 351 xvdial.o xvgraf.o xvsunras.o xvjpeg.o xvps.o xvpopup.o xvdflt.o \ 352 xvtiff.o xvtiffwr.o xvpds.o xvrle.o xviris.o xvgrab.o vprintf.o \ 353 xvbrowse.o xvtext.o xvpcx.o xviff.o xvtarga.o xvxpm.o xvcut.o \ 354 xvxwd.o xvfits.o xvpng.o xvzx.o xvwbmp.o xvpcd.o xvhips.o \ 355 xvmag.o xvpic.o xvmaki.o xvpi.o xvpic2.o xvvd.o xvmgcsfx.o \ 356 xvml.o xvjp2k.o 357 358MISC = README INSTALL CHANGELOG IDEAS 359 360 361 362.c.o: ; $(CC) $(CFLAGS) -c $*.c 363 364 365 366#all: $(JPEGLIB) $(TIFFLIB) xv bggen vdcomp xcmap xvpictoppm 367all: xv bggen vdcomp xcmap xvpictoppm 368 369 370#xv: $(OBJS) $(JPEGLIB) $(TIFFLIB) 371xv: $(OBJS) 372 $(CC) -o xv $(CFLAGS) $(OBJS) $(LIBS) 373 374bggen: bggen.c 375 $(CC) $(CFLAGS) -o bggen bggen.c $(LIBS) 376 377vdcomp: vdcomp.c 378 $(CC) $(CFLAGS) -o vdcomp vdcomp.c 379 380xcmap: xcmap.c 381 $(CC) $(CFLAGS) -o xcmap xcmap.c $(LIBS) 382 383xvpictoppm: xvpictoppm.c 384 $(CC) $(CFLAGS) -o xvpictoppm xvpictoppm.c 385 386 387 388xvclean: 389 rm -f $(OBJS) xv 390 391clean: xvclean 392 rm -f bggen vdcomp xcmap xvpictoppm 393# clean only local jpeg and tiff dirs, not user's or system's copies: 394 ./$(CLEANDIR) jpeg 395 rm -f jpeg/jconfig.h jpeg/Makefile 396 ./$(CLEANDIR) tiff 397 398 399# could also do some shell trickery here to attempt mkdir only if dir is 400# missing (e.g., "test -d <dir> || $(MKDIR) <dir>") 401install: all 402 $(MKDIR) $(DESTDIR)$(BINDIR) 403 cp xv bggen vdcomp xcmap xvpictoppm $(DESTDIR)$(BINDIR)/. 404 chmod 755 $(DESTDIR)$(BINDIR)/xv $(DESTDIR)$(BINDIR)/bggen \ 405 $(DESTDIR)$(BINDIR)/vdcomp $(DESTDIR)$(BINDIR)/xcmap \ 406 $(DESTDIR)$(BINDIR)/xvpictoppm 407# 408 $(MKDIR) $(DESTDIR)$(MANDIR) 409 cp docs/xv.man $(DESTDIR)$(MANDIR)/xv.$(MANSUF) 410 cp docs/bggen.man $(DESTDIR)$(MANDIR)/bggen.$(MANSUF) 411 cp docs/xcmap.man $(DESTDIR)$(MANDIR)/xcmap.$(MANSUF) 412 cp docs/xvp2p.man $(DESTDIR)$(MANDIR)/xvpictoppm.$(MANSUF) 413 cp docs/vdcomp.man $(DESTDIR)$(MANDIR)/vdcomp.$(MANSUF) 414 chmod 644 $(DESTDIR)$(MANDIR)/xv.$(MANSUF) \ 415 $(DESTDIR)$(MANDIR)/bggen.$(MANSUF) \ 416 $(DESTDIR)$(MANDIR)/xcmap.$(MANSUF) \ 417 $(DESTDIR)$(MANDIR)/xvpictoppm.$(MANSUF) \ 418 $(DESTDIR)$(MANDIR)/vdcomp.$(MANSUF) 419# 420 $(MKDIR) $(DESTDIR)$(DOCDIR) # or $(DESTDIR)$(LIBDIR) 421 cp README.jumbo docs/xvdocs.pdf docs/xvdocs.ps $(DESTDIR)$(DOCDIR)/. 422 chmod 644 $(DESTDIR)$(DOCDIR)/README.jumbo \ 423 $(DESTDIR)$(DOCDIR)/xvdocs.pdf $(DESTDIR)$(DOCDIR)/xvdocs.ps 424# 425 #$(MKDIR) $(DESTDIR)$(SYSCONFDIR) 426 #cp xv_mgcsfx.sample $(DESTDIR)$(SYSCONFDIR)/xv_mgcsfx 427 #chmod 644 $(DESTDIR)$(SYSCONFDIR)/xv_mgcsfx 428 429 430tar: 431# tar only local jpeg and tiff dirs, not user's or system's copies: 432 tar cvf xv.tar Makefile* Imakefile *.c *.h bits \ 433 docs unsupt vms jpeg tiff $(MISC) 434 435xvtar: 436 tar cvf xv.tar Makefile* Imakefile *.c *.h bits 437 438$(OBJS): xv.h config.h 439 440 441################# bitmap dependencies #################### 442 443xv.o: bits/icon bits/iconmask bits/runicon bits/runiconm 444xv.o: bits/cboard50 bits/gray25 445 446xvbrowse.o: bits/br_file bits/br_dir bits/br_exe bits/br_chr bits/br_blk 447xvbrowse.o: bits/br_sock bits/br_fifo bits/br_error # bits/br_unknown 448xvbrowse.o: bits/br_cmpres bits/br_bzip2 bits/br_gif bits/br_pm bits/br_pbm 449xvbrowse.o: bits/br_sunras bits/br_bmp bits/br_utah bits/br_iris 450xvbrowse.o: bits/br_pcx bits/br_jfif bits/br_tiff bits/br_pds bits/br_pcd 451xvbrowse.o: bits/br_ps bits/br_iff bits/br_targa bits/br_xpm bits/br_xwd 452xvbrowse.o: bits/br_fits bits/br_png bits/br_zx bits/br_mag bits/br_maki 453xvbrowse.o: bits/br_pic bits/br_pi bits/br_pic2 bits/br_mgcsfx 454xvbrowse.o: bits/br_jp2 bits/br_jpc 455xvbrowse.o: bits/br_trash bits/fcurs bits/fccurs bits/fdcurs bits/fcursm 456 457xvbutt.o: bits/cboard50 bits/rb_frame bits/rb_frame1 bits/rb_top 458xvbutt.o: bits/rb_bot bits/rb_dtop bits/rb_dbot bits/rb_body 459xvbutt.o: bits/rb_dot bits/cb_check bits/mb_chk 460 461xvctrl.o: bits/gray25 bits/gray50 bits/i_fifo bits/i_chr bits/i_dir 462xvctrl.o: bits/i_blk bits/i_lnk bits/i_sock bits/i_exe bits/i_reg 463xvctrl.o: bits/h_rotl bits/h_rotr bits/fliph bits/flipv bits/p10 464xvctrl.o: bits/m10 bits/cut bits/copy bits/paste bits/clear 465xvctrl.o: bits/uicon bits/oicon1 bits/oicon2 bits/icon 466xvctrl.o: bits/padimg bits/annot 467 468xvcut.o: bits/cut bits/cutm bits/copy bits/copym 469 470xvdflt.o: bits/logo_top bits/logo_bot bits/logo_out bits/xv_jhb 471xvdflt.o: bits/xv_cpyrt bits/xv_rev bits/xv_ver 472xvdflt.o: bits/xf_left bits/xf_right bits/font5x9.h 473xvdflt.o: xvdflt.h 474 475xvdial.o: bits/dial_cw1 bits/dial_ccw1 bits/dial_cw2 bits/dial_ccw2 476 477xvdir.o: bits/d_load bits/d_save 478 479xvevent.o: bits/dropper bits/dropperm bits/pen bits/penm 480xvevent.o: bits/blur bits/blurm 481 482xvgam.o: bits/h_rotl bits/h_rotr bits/h_flip bits/h_sinc bits/h_sdec 483xvgam.o: bits/h_sat bits/h_desat 484 485xvgraf.o: bits/gf1_addh bits/gf1_delh bits/gf1_line bits/gf1_spln 486xvgraf.o: bits/gf1_rst bits/gf1_gamma 487 488xvinfo.o: bits/penn bits/pennnet 489 490xvmisc.o: bits/fc_left bits/fc_leftm bits/fc_left1 bits/fc_left1m 491xvmisc.o: bits/fc_mid bits/fc_midm bits/fc_right1 bits/fc_right1m 492xvmisc.o: bits/fc_right bits/fc_rightm 493 494xvpopup.o: bits/icon 495 496xvroot.o: bits/root_weave 497 498xvscrl.o: bits/up bits/down bits/up1 bits/down1 bits/uph bits/downh 499xvscrl.o: bits/uph1 bits/downh1 bits/scrlgray 500 501################# end bitmap dependencies #################### 502 503 504 505