multiple target make -- the conclusion

Marty Leisner.Henr at xerox.com
Sun Apr 30 04:29:26 AEST 1989


Thanks for all the help for the multiple target make question.

Responses are on arisia.xerox.com:pub/multipletargets.mail.  You can
anonymous ftp to it.  If it's a problem, send me mail.

It is an XDE mail file (all ascii text) -- there's some junk between
messages but it should be readable.

What I'm doing is using GNU make and using configuration ifdefs to
configure various compiler options.

On a sun386i, I'm doing something like this:

VPATH = ..
 
ifeq ($(TARGET),DOS)
 
include make/dosaztec.mk
LIBLD=../libld.lib
LIBS=-lunix -ls -lc
CFLAGS=+2 -I../../libld  -DPC -I.. -DFAR=far $(ENV_FLAGS) 
LINKOBJS=-f objects     # use this since we can't pass long lines in plain
dos
TARGET_OBJ =    int80286.o backgrnd.o 8259.o
LINKOBJS=$(OBJS)
else
CC=gcc
OPTIMIZE=-O
CFLAGS=$(OPTOMIZE) -g -I../../libld -I.. -DFAR= -DSUN386
-Dscr_printf=printf  
TARGET_OBJ=memmap.o dos-compat.o
T= sun386
LD=gcc
LDFLAGS=$(CFLAGS)
NO_LINK=-c
LIBS=
LDFLAGS=
EXE=
endif
 
BINS=swiss$(EXE) sdb$(EXE)
.PHONY: all test clean this
 
# make target according to current environment
this:
        $(MAKE) -C $T  -f ../Makefile $(BINS)
all:
        $(MAKE) TARGET=DOS
        $(MAKE) TARGET=UNIX
 
.DEFAULT:
        $(MAKE) -C $T -f ../Makefile $@
 
swiss$(EXE):    $(OBJS) swiss.o
        $(CC) -o version.o $(NO_LINK) ../version.c
ifeq ($(TARGET),DOS)
        echo $(OBJS) version.o swiss.o >objects; \
        $(LD) -o $@  version.o $(LINKOBJS) $(LIBLD)  $(LIBS)
else
        $(CC) -o $@ version.o $^  $(LIBLD) $(LIBS)
endif 

clean:
        rm $(addprefix $T/,$(OBJS))
        rm $(addprefix $T/,$(BINS))
        rm $T/core
 
cleanall:
        $(MAKE) clean TARGET=DOS
        $(MAKE) clean TARGET=UNIX
		
I configure a subdirectory ($T) for all my target objects, and make out of
there with vpath set to ..

I'm using various make include files to configure rules for compilation.

(I don't think the default rule is right).

I allows a few things I've found very useful:
doing a 
%setenv TARGET machine
allows you to work in a shell building one particular type of target.

Doing make TARGET=machine
allows you to make that target.

Seems to be working pretty good so far.

I haven't done any real big projects yet with this -- I may get gnu C up
and running with this method.


marty
ARPA:	leisner.henr at xerox.com
GV:  leisner.henr
NS:  martin leisner:wbst139:xerox
UUCP:	hplabs!arisia!leisner
 



More information about the Comp.unix.wizards mailing list