File:  [Apple XNU] / GNUtools / Makefile
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:45:09 2018 UTC (8 years, 2 months ago) by root
Branches: MAIN, Apple
CVS tags: HEAD, GNUtools33
GNU tools for NeXTSTEP 3.3

##
##  NeXT C Compiler Makefile.  
##
##  Ask Kresten if you have any torubles / questions.
##

#
# ** MANUAL BUILDS **
#
# Use: 
#	make debug TARGETS='i386 m68k ...'
#
# from this directory to do manual builds.  The build compiler(s) will
# appear in ./obj/cc-<target>-on-<host>/ subdirectories of here.  Use
# "./xgcc -B./" in there to run the specific compiler.  You can also
# just cd to a specific ./obj subdirectory and type "make <foo>" to build
# a specific program, like "cpp" or "cc1objplus".  
#
# The makefile will automatically make a clone of the latest binaries
# the first time "make debug" is run.  The binaries are kept outside
# of the revision control system.

#
# ** AUTOMATIC BUILDS **
#
# Automatic builds strictly follow the RC makefile API standards.  However,
# in order to do a full build, a bootstrap is needed.  To do this, simply
# do "make bootstrap" on the build machine, and install the resulting
# symbols in the BuildRoot.  Then, do an ordinary "make install". 
#

TARGETS= m68k i386 hppa sparc
HOSTS= `arch`

RC_ARCHS= $(HOSTS)

SRCROOT=.

SRC= `cd $(SRCROOT); pwd | sed s,/private,,`
DSTROOT= $(SRC)/dst
SYMROOT= $(SRC)/sym
OBJROOT= $(SRC)/obj

##
## build compilers for targets=$(TARGETS), and hosts=$(RC_ARCHS).
## bootstrap target must have been run before this.  
##
debug: obj.clone 
	./build_gcc --thins \
		--srcroot=$(SRC) \
		--dstroot=$(DSTROOT) \
		--objroot=$(OBJROOT) \
		--symroot=$(SYMROOT) \
		--cflags="$(RC_CFLAGS) -g" \
		--hosts="$(RC_ARCHS)" \
		--targets="$(TARGETS)"

obj.clone:
	@root=$(OBJROOT); \
	if ls -lgd $$root | egrep '^l'; then \
	  echo "============================================"; \
	  echo "== CLONING BINARIES, WILL TAKE A WHILE... =="; \
	  echo "============================================"; \
	  mv $$root $$root.lnk; \
	  mkdir $$root; cd $$root.lnk; \
	  find . -depth -print | cpio -pdl $$root; \
	fi; \
	touch obj.clone

obj.unclone:
	root=$(OBJROOT); \
	if ls -lgd $$root.lnk | egrep '^l'; then \
	  echo "============================================"; \
	  echo "==  REMOVING BINARIES, WILL TAKE A WHILE  =="; \
	  echo "============================================"; \
	  mv $$root $$root.tree; \
	  mv $$root.lnk $$root; \
	  /bin/rm -Rf $$root.tree; \
	fi; \
	/bin/rm -f obj.clone

config: 
	./build_gcc --configure \
		--srcroot=$(SRC) \
		--dstroot=$(DSTROOT) \
		--objroot=$(OBJROOT) \
		--symroot=$(SYMROOT) \
		--cflags="$(RC_CFLAGS) -g" \
		--hosts="$(RC_ARCHS)" \
		--targets="$(TARGETS)"

build: build_bison build_c++filt
	./build_gcc --thins \
		--srcroot=$(SRC) \
		--dstroot=$(DSTROOT) \
		--objroot=$(OBJROOT) \
		--symroot=$(SYMROOT) \
		--cflags="$(RC_CFLAGS) -g" \
		--hosts="$(RC_ARCHS)" \
		--targets="$(TARGETS)"

install: build install_bison install_c++filt
	./build_gcc --fats \
		--srcroot=$(SRC) \
		--dstroot=$(DSTROOT) \
		--objroot=$(OBJROOT) \
		--symroot=$(SYMROOT) \
		--cflags="$(RC_CFLAGS)" \
		--hosts="$(RC_ARCHS)" \
		--targets="$(TARGETS)"
	make installGNUsrc SRCROOT=$(DSTROOT)/NextDeveloper/Source/GNU
	mkdirs $(DSTROOT)/usr/local/RelNotes
	install -m 555 cc++ $(DSTROOT)/bin
	install -m 555 ld++ $(DSTROOT)/bin
	install -m 444 Compiler.rtf $(DSTROOT)/usr/local/RelNotes
	install -m 444 CompilerPrivate.rtf $(DSTROOT)/usr/local/RelNotes

##
## build compilers for target=$(RC_ARCHS), and host=`arch`
##
bootstrap: build_bison
	./build_gcc --fats \
		--srcroot=$(SRC) \
		--dstroot=$(DSTROOT) \
		--objroot=$(OBJROOT) \
		--symroot=$(SYMROOT) \
		--cflags="$(RC_CFLAGS)" \
		--hosts=`arch` \
		--targets="$(RC_ARCHS)"

clean: clean_bison
	./build_gcc --clean \
		--srcroot=$(SRC) \
		--dstroot=$(DSTROOT) \
		--objroot=$(OBJROOT) \
		--symroot=$(SYMROOT) \
		--cflags="$(RC_CFLAGS)" \
		--hosts="$(RC_ARCHS)" \
		--targets="$(TARGETS)"


installsrc: SRCROOT
	mkdirs $(SRCROOT)/cc
	if [ $(SRCROOT) != . ]; then \
	  tar cBf - `ls -1 | egrep -v '^(obj|dst|sym)$'` \
		 | (cd $(SRCROOT); tar xvf -); \
	fi

installGNUsrc: SRCROOT
	mkdirs $(SRCROOT)/cc
	if [ $(SRCROOT) != . ]; then \
	  tar cBf - `ls -1 | egrep -v '^(obj|dst|sym|SGS)$'` \
		 | (cd $(SRCROOT); tar xvf -); \
	  chown -R root.wheel $(SRCROOT); \
	fi

installhdrs: DSTROOT


DSTROOT:
	mkdirs $(DSTROOT)


SRCROOT:
	@if [ -n "${$@}" ]; \
	then \
		exit 0; \
	else \
		echo Must define $@; \
		exit 1; \
	fi

build_c++filt:  
	(cd $(SRCROOT)/c++filt; \
		$(MAKE) build \
			SYMROOT="$(SYMROOT)" \
			SRCROOT="$(SRCROOT)" )

install_c++filt:  
	(cd $(SRCROOT)/c++filt; \
		$(MAKE) install \
			SYMROOT="$(SYMROOT)" \
			DSTROOT="$(DSTROOT)" \
			SRCROOT="$(SRCROOT)" )

build_bison: $(OBJROOT)/bison_`arch`_obj/Makefile
	(cd $(OBJROOT)/bison_`arch`_obj; \
		make CFLAGS="${RC_CFLAGS}" \
		LDFLAGS="${RC_CFLAGS}" )
        
$(OBJROOT)/bison_`arch`_obj:
	mkdirs $(OBJROOT)/bison_`arch`_obj

$(OBJROOT)/bison_`arch`_obj/Makefile: $(OBJROOT)/bison_`arch`_obj
	(cd $(OBJROOT)/bison_`arch`_obj; $(SRCROOT)/bison/configure)
        
install_bison: build_bison
	mkdirs $(DSTROOT)/usr/local
	(cd $(OBJROOT)/bison_`arch`_obj; \
	$(MAKE) install \
	CFLAGS="${RC_CFLAGS}" \
		LDFLAGS="${RC_CFLAGS}" \
		prefix="$(DSTROOT)/usr/local")

clean_bison:
	-(cd $(OBJROOT)/obj.bison; $(MAKE) clean)


unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.