################################################################### # # # SSSS M M # # S S MM MM # # S M M M M # # SSSS M M M M # # S M M M # # S S M M # # SSSS M M # # # # # ################################################################### # # This makefile makes various standalone programmes, and then # SM itself, in subdirectory src. See the makefile in src # and (especially) the file options.h to modify the ways that SM is compiled. # You may well be able to set these with the set_opts script in this directory # # If you change (e.g.) the value of CC in this Makefile, you must # always run always make from this directory or from ./src # .c.o : $(CC) -c $(CFLAGS) $*.c # # Which compiler to use. # # When compiling control.y you will get two from bison.simple. # Compiling SM itself should produce a single complaint from each main # programme, as gcc doesn't understand exit(). # CC = cc -Dhp # # cc flags # CFLAGS = -g -I/scisoft/sm/sm2_4_2/src # # Installation directories: # DESTDIR : binaries (sm and rasterise) # DESTLIB: libraries (libdevices.a, libplotsub.a, and libutils.a) # DESTETC: (miscellaneous files, and macro and help directories) # DESTMAN: manual page(s) # DESTLISP: emacs lisp files # DEST = /scisoft DESTDIR = $(DEST)/bin DESTLIB = $(DEST)/lib DESTETC = $(DEST)/lib/sm DESTINFO = $(DEST)/info DESTMAN = $(DEST)/man/man1 DESTLISP = $(DEST)/emacs/site-lisp # # Suffix for SM libraries; usually "" if REAL is float, _d if double # LIBSUFFIX = # # Path to search for .sm files # DEFAULT_PATH =". ~ $(DESTETC)/" # # linker flags # LDFLAGS = -lm # # This seems to be needed by a convex # MAKE = make # # If you don't need ranlib comment out the definition # RANLIB = /usr/bin/ranlib # # Don't change this, please # SHELL = /bin/sh # # Make all targets (should be first in Makefile) # all : notice sm fonts misc notice : @- echo "" @- echo SM is copyright 1987, 1989, 1990, 1992, 1993 Robert Lupton and Patricia Monger. @- echo You may not distribute either source or executables without @- echo specific permission from the authors. See the file copyright.h @- echo for more details. @- echo "" # # # # Make SM # sm : ( cd src ; \ $(MAKE) $(MFLAGS) "CC=$(CC)" "CFLAGS=$(CFLAGS)" "RANLIB=$(RANLIB)" \ DEFAULT_PATH=$(DEFAULT_PATH) all_src ) # # copy executable to current release version. # install : @- echo Installing SM @- for f in $(DESTDIR) $(DESTLIB) $(DESTETC) $(DESTMAN) $(DESTLISP);\ do \ if test "$$f" = ""; then continue; fi; \ fd=`echo $$f | sed -e 's#/[^/]*$$##'`; \ if test ! -d $$fd ; then \ echo creating $$fd; mkdir $$fd; \ fi ; \ if test ! -d $$f ; then \ echo creating $$f; mkdir $$f; \ fi; \ done cp src/sm rasterise $(DESTDIR) @ for f in libdevices libplotsub libutils libparser; do \ if test -f src/$$f.a; then \ echo " cp src/$$f.a $(DESTLIB)/$${f}$(LIBSUFFIX).a";\ cp src/$$f.a $(DESTLIB)/$${f}$(LIBSUFFIX).a; \ fi; \ done @ if test "$(RANLIB)" != "" -a -f "$(RANLIB)"; then \ ( cd $(DESTLIB); \ for f in libdevices libplotsub libutils libparser; do \ if test -f $${f}$(LIBSUFFIX).a; then \ $(RANLIB) $${f}$(LIBSUFFIX).a; \ fi; \ done; \ ); fi cp filecap graphcap fonts.bin $(DESTETC) @ if test "$(DESTLISP)" != ""; then \ echo " cp sm.el $(DESTLISP)/sm.el"; \ cp sm.el $(DESTLISP)/sm.el; fi; @ if test -f $(DESTETC)/graphcap.local; then \ echo "graphcap.local exists; I am not modifying it"; \ else \ echo " Setting up graphcap.local"; \ echo "BIN = $(DESTDIR)" > $(DESTETC)/graphcap.local; \ fi @ if test ! -f /etc/termcap; then cp termcap $(DESTETC); fi @- echo " Copying macro and help directories" @ for f in macro help; do \ if test ! -d $(DESTETC)/$$f ; then \ mkdir $(DESTETC)/$$f ; \ fi ; \ cp `find $$f ! -type d -print` $(DESTETC)/$$f ; \ done cp sm.man $(DESTMAN)/sm.1 @ if test ! -d $(DESTETC) ; then mkdir $(DESTETC); fi @- if test -f $(DESTETC)/.sm; then \ echo File $(DESTETC)/.sm exists\; I am not modifying it; \ else \ ( \ echo "fonts $(DESTETC)/fonts.bin" ;\ echo "history_file .smhist" ;\ echo "history 80" ;\ echo "temp_dir /tmp/" ;\ echo "+graphcap $(DESTETC)/graphcap.local" ;\ for f in filecap graphcap ; do \ echo "$$f $(DESTETC)/$$f" ;\ done;\ if test ! -f /etc/termcap; then \ echo "termcap $(DESTETC)/termcap" ;\ fi; \ for f in help macro ; do \ echo "$$f $(DESTETC)/$$f/" ;\ done;\ ) > $(DESTETC)/.sm; \ fi installinfo : ( cd info ; $(MAKE) $(MFLAGS) DESTINFO=$(DESTINFO) installinfo ) # # Now various stand-alone programmes: # # Convert the fonts to binary format # read_fonts : read_fonts.o $(CC) $(CFLAGS) -o read_fonts read_fonts.o -lm # fonts : fonts.bin fonts.bin : read_fonts hershey_oc.dat font_index tex.def ./read_fonts hershey_oc.dat font_index tex.def fonts.bin jfonts.bin : cat_fonts fonts.bin hershey_or.dat jfont_index jtex.def ./read_fonts hershey_or.dat jfont_index jtex.def jfonts.bin~ ./cat_fonts -o jfonts.bin fonts.bin jfonts.bin~ @- rm -f jfonts.bin~ # # concatenate font files # cat_fonts : cat_fonts.o src/fonts.h $(CC) $(CFLAGS) -o cat_fonts cat_fonts.o # # Various things need compiling: # misc : rasterise @- sh config $(CC) $(CFLAGS) # # Bootstrap compile_g without a valid cacheg.dat file # (not made by default) # boot_g : compile_g.o src/tty.h $(CC) -DBOOTSTRAP -o boot_g -Isrc compile_g.c # # The programme to compile graphcap entries # compile_g.o : src/dummies.h src/tty.h compile_g : compile_g.o src/libdevices.a src/libutils.a $(CC) -o compile_g compile_g.o -Lsrc -ldevices -lutils $(LDFLAGS) # # Extract the grammar from a yacc/bison file # get_grammar : get_grammar.o $(CC) -o get_grammar get_grammar.o # # Rasterise vector files produced by the "raster" device # rasterise.o : src/dummies.h rasterise : rasterise.o src/libdevices.a src/libutils.a $(CC) -o rasterise rasterise.o -Lsrc -ldevices -lutils $(LDFLAGS) # # Here is the library to allow a programme to call the SM parser. # (not built by default) # Parser : ( cd src ; \ $(MAKE) $(MFLAGS) "CC=$(CC)" "CFLAGS=$(CFLAGS)" "RANLIB=$(RANLIB)" \ DEFAULT_PATH=$(DEFAULT_PATH) libparser.a ) # # prepare a distribution of SM # distrib : @ if test ! -f src/control.c -o ! -f src/control.h; then \ echo Please provide control.c and control.h; \ exit 1; \ fi @ sh add_copyright @ echo "Making sm.install from info/install.txi" @ $(MAKE) sm.install > /dev/null @ find . \( -name CVS -prune -o -name .cvsignore \) -exec rm -rf {} \; @ rm -f .set_opts @ /bin/cp /dev/null .config @ rm -f read_fonts cat_fonts fonts.bin rasterise compile_g boot_g \ src/sm @ if grep '$$Name\$$' AA_Version.h > /dev/null 2>&1 ; then \ echo -n "Version? "; \ read ver; \ perl -pi \ -e '($$ver = "'"$$ver"'") =~ s/\./_/g;' \ -e '$$ver =~ s/^SM//;' \ -e 's/\$$Name\$$/\$$Name: SM2_4_1 $$ver \$$/;' \ AA_Version.h; \ fi sm.install : _sm_install _sm_install : @ ( cd info ; $(MAKE) ../sm.install ) # # clean out all object code and junk files # empty : clean - rm -f fonts.bin read_fonts rasterise compile_g boot_g Makefile - (cd src ; $(MAKE) empty ) - (cd info ; $(MAKE) empty ) clean : tidy - rm -f *.o patch/*.o get_grammar - (cd src ; $(MAKE) clean ) - (cd callable ; $(MAKE) clean ) - (cd info ; $(MAKE) clean ) # tidy : - rm -f *.ckp core *~ .*~ *.orig *.rej - (cd src ; $(MAKE) tidy ) - rm -f doc/*.log doc/*.dvi doc/*~ doc/*.orig doc/*.rej \ doc/index1.tex doc/contents1.tex \ help/*~ help/*.orig help/*.rej \ macro/*~ macro/*.orig macro/*.rej \ patch/*~ patch/*.orig patch/*.rej - (cd info ; $(MAKE) tidy ) # # Here are all the dependencies: # #START_DEPEND cat_fonts.o : src/fonts.h read_fonts.o : src/fonts.h read_fonts.o : src/options.h