micky@cunixc.cc.columbia.edu (Micky Liu) (09/11/89)
Following is a very simplistic Makefile for building executables from a single source tree for machines of different architectures. I received many inquiries for the information I gathered, but I only received one clue... I ended up using the VPATH variable which does not work on the SGI, so I will be installing GNUmake probably... This Makefile has several deficiencies, it will only build the primary target (I will work on multiple targets later). It does not know anything about RCS (my next job). Other than that it works okay as long as the VPATH variable works for your particular flavor of make. What it does is determine the type of machine it is running on, I made symlinks to /bin/true where applicable and /bin/false in other places (lame I know but hey it works). Then it makes a recursive call to itself setting some variables and voila! Have Fun! Micky arpa: micky@cunixc.cc.columbia.edu uucp: ...!rutgers!columbia!cunixc!micky bitnet: malua@cuvmc ========================================================================== SHELL=/bin/sh all: @if convex; then \ make t \ ARCH="convex" \ FC="/usr/convex/fc" \ VPATH="./convex" \ FFLAGS="-vfc -O0"; \ elif iris; then \ make t \ ARCH="iris" \ FC="/usr/bin/f77" \ VPATH="./iris" \ FFLAGS=""; \ elif apollo; then \ make t \ ARCH="apollo" \ FC="/usr/bin/f77" \ VPATH="./apollo" \ FFLAGS=""; \ fi SRCS = t.f t1.f OBJS = t.o t1.o .f.o: $(FC) $(FFLAGS) -c $*.f mv $*.o $(ARCH)/. t.o: t.f t1.o: t1.f t: $(OBJS) $(FC) $(OBJS) -o $(ARCH)/t