# Copyright (c) 1993 Xerox Corporation. All rights reserved. # #-$Id$ # #-$Date$ # MYHOME = /tilde/nanolan MYBIN = $(MYHOME)/bin # # VERY IMPORTANT: # NO target-config-dependent things go in in Makefile directly. # ALL target-config-dependent things go in config.mk, below. # # # # include config.mk here to define: # # PACKAGE - name of this package (e.g. libc) # TARGET←ARCH - target machine architecture (e.g. mc68000) # TARGET←CONFIG - target machine configuration name (e.g. BASE) # # CC - C compiler # CONFIG←CPPFLAGS # CONFIG←CFLAGS # # ASPP - assembler preprocessor (CPP) # CONFIG←ASPPFLAGS # # AS - assembler # CONFIG←ASFLAGS # # LD - loader # CONFIG←LDFLAGS # include config.mk # # location of shared sources # SHARED←SRC←TREE = $(MYHOME)/lib/src INCLUDE = -I. -I$(SHARED←SRC←TREE)/libc -I$(SHARED←SRC←TREE) # # locations of object files # CONFIG←OBJ←TREE = $(MYHOME)/lib/$(TARGET←CONFIG) INSTALL←LIB = $(CONFIG←OBJ←TREE)/lib INSTALL←BIN = $(CONFIG←OBJ←TREE)/bin # # compilation flags, etc. # CPPFLAGS = $(INCLUDE) -D$(TARGET←CONFIG) $(CONFIG←CPPFLAGS) CFLAGS =-c -O $(CONFIG←CFLAGS) ASPPFLAGS = $(INCLUDE) $(CONFIG←ASPPFLAGS) -DASM -D$(TARGET←CONFIG) ASFLAGS = $(CONFIG←ASFLAGS) LDFLAGS = -N -Ttext 0 $(CONFIG←LDFLAGS) # # standard commands and default rules # CHECKIN = $(MYBIN)/checkin CHECKOUT = $(MYBIN)/checkout INSTALL = cp -p .s.o: $(ASPP) $(ASPPFLAGS) $< | $(AS) $(ASFLAGS) -o $@ .c.o: $(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@ # # # # # BEGIN PACKAGE-SPECIFIC PART # # # # # # Default target # default: ???? # # SOURCE FILE DEFINITION # # define CSRC SSRC MISCSRC HDEFS MISCDEFS. # # define MAKEDEP←MISCSRC = commands to make MISCSRC dependencies # (dependencies for .c and .s files are done automatically). # CSRC = ???.c SSRC = ???.s MISCSRC = SRC = $(CSRC) $(SSRC) $(MISCSRC) MAKEDEP←MISCSRC = HDEFS = ???.h MISCDEFS = DEFS = $(HDEFS) $(MISCDEFS) # # # INSTALL DEFINITION # # define INSTALL←LIBFILES = targets to be copied into INSTALL←LIB # define INSTALL←BINFILES = targets to be copied into INSTALL←BIN # INSTALL←LIBFILES = ????.a INSTALL←BINFILES = ????.o # # package-specific definitions and rules # COBJ = mypkg.o SOBJ = mypkg←support.o MISCOBJ = mypkg: $(COBJ) $(SOBJ) $(MISCOBJ) $(LD) -o mypkg $(COBJ) $(SOBJ) $(MISCOBJ) \ $(CONFIG←OBJ←TREE)/other/libother.a # # # # # END PACKAGE-SPECIFIC PART # # # # # # # STANDARD TARGETS # # # # make install # install: $(INSTALL←LIBFILES) $(INSTALL←BINFILES) if [ -n "$(INSTALL←LIBFILES)" ] ; then \ ( cd $(INSTALL←LIB) ; rm -f $(INSTALL←LIBFILES) ) ; \ $(INSTALL) $(INSTALL←LIBFILES) $(INSTALL←LIB) ; \ fi if [ -n "$(INSTALL←BINFILES)" ] ; then \ ( cd $(INSTALL←BIN) ; rm -f $(INSTALL←BINFILES) ) ; \ $(INSTALL) $(INSTALL←BINFILES) $(INSTALL←BIN) ; \ fi $(CHECKIN) -l # # make clean # clean: rm -f *.o *~ core a.out *.a *.BAK *.bak *.CKP logmsg.txt # # make get -- get source files without locking # get: $(CHECKOUT) -calledfrommake -u $(SRC) $(DEFS) # # make checkout -- checkout and lock source files # checkout: $(CHECKOUT) -calledfrommake -l Makefile $(SRC) $(DEFS) # # make unlock -- check in and unlock all files # unlock: $(CHECKIN) -calledfrommake -u $(SRC) $(DEFS) Makefile $(MAKE) push # # make save -- check in files but keep locks and working copies # save: $(CHECKIN) -calledfrommake -l $(SRC) $(DEFS) Makefile $(MAKE) push # # make checkin -- check in files, delete working copies # checkin: $(CHECKIN) $(SRC) $(DEFS) $(CHECKIN) -calledfrommake -u -logmsg /dev/null Makefile $(MAKE) push # # make push -- update src directory copies # push: (cd $(SHARED←SRC←TREE)/$(PACKAGE); \ $(CHECKOUT) -calledfrommake -u $(SRC) $(DEFS) ) # # make depend # # NOTE: the makefile must include "# DO NOT DELETE THIS LINE" # and at least one additional line of text after the last target. # "make depend" will replace everything following that line # by a newly-constructed list of dependencies. # # You can modify the behavior of this target by defining $(MAKEDEP←MISCSRC). # makedep: $(CSRC) $(SSRC) $(MISCSRC) echo -n > makedep $(MAKEDEP←MISCSRC) if [ "x$(CSRC)" != x ]; then \ $(CC) -M $(CPPFLAGS) $(CSRC) \ | sed -e '/:$$/d' >> makedep ; \ fi for x in $(SSRC) END ; \ do if [ $$x != END ]; then \ $(ASPP) -M $(ASPPFLAGS) $$x \ | sed -e '/:$$/d' \ | sed -e 's/[.]s[.]o :/.o :/g' >> makedep ; \ fi ; \ done depend: makedep echo '/↑# DO NOT DELETE THIS LINE/+1,$$d' > eddep echo '$$r makedep' >> eddep echo 'w' >> eddep rm -f Makefile.bak mv Makefile Makefile.bak cp Makefile.bak Makefile chmod u+w Makefile ex - Makefile < eddep if [ ! -w Makefile.bak ] ; then chmod u-w Makefile ; fi rm -f eddep makedep # # # END OF HUMAN-EDITABLE PART # # # #-$Log$ # # # DO NOT DELETE THIS LINE -- make depend depends on it # and there had better be at least one additional line