From: Marcus A. S. <mar...@us...> - 2001-02-28 23:40:55
|
The following file was modified in apps: Name Old version New version Comment ---- ----------- ----------- ------- Rules.elinux 1.1 1.2=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Fixed the build system. It was very screwed up! You can now to: 1. ./init_env 2. make and all the code will be built. The diff of the modified file(s): --- Rules.elinux 2001/02/18 12:35:43 1.1 +++ Rules.elinux 2001/02/28 23:42:08 1.2 @@ -80,7 +80,7 @@ =20 endif =20 -INSTALL =3D install_elinux +INSTALL =3D install =20 ########################################################################### =20 |
From: Peter K. <pk...@us...> - 2001-05-07 11:23:57
|
The following file was modified in apps: Name Old version New version Comment ---- ----------- ----------- ------- Rules.elinux 1.2 1.3=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Synchronized with our latest version of this file (requires make 3.79 if I am not mistaken). The diff of the modified file(s): --- Rules.elinux 2001/02/28 23:42:08 1.2 +++ Rules.elinux 2001/05/07 11:23:57 1.3 @@ -1,17 +1,66 @@ # Hey Emacs, this Makefile is in -*- makefile -*- mode! =20 -# If we are building for elinux, then define ELINUX +makefrag_name =3D .target-makefrag + +ifndef AXIS_BUILDTYPE +# If we have a .target-makefrag, read stuff from it. Else we will +# probably create one, so define ROOT_MAKEFRAG. +ifeq ($(makefrag_name),$(wildcard $(makefrag_name))) +include $(makefrag_name) +endif # An $(makefrag_name) existing in current directory. + +# Backward compatibility with the old .target_* files. +ifndef AXIS_BUILDTYPE ifeq (.target_elinux,$(wildcard .target_*)) -ELINUX=3D1 +AXIS_BUILDTYPE=3Delinux endif - -# If we are building for cris (Linux/CRIS), then define CLINUX ifeq (.target_clinux,$(wildcard .target_*)) -CLINUX=3D1 +AXIS_BUILDTYPE=3Dclinux +endif +ifeq (.target_host,$(wildcard .target_*)) +AXIS_BUILDTYPE=3Dhost +endif endif =20 +endif # !AXIS_BUILDTYPE + SUBDIRS +=3D dummy +AXIS_WARNING_PREFIX =3D ---------- WARNING: +AXIS_ERROR_PREFIX =3D ---------- ERROR: +AXIS_USE_UCLIBC_DEPRECATED =3D Makefile in $(shell pwd) sets deprecated \ +USE_UCLIBC. It should set AXIS_USABLE_LIBS =3D UCLIBC +AXIS_LIB_MISMATCH =3D The code in $(shell pwd) cannot be linked with\ + $(AXIS_WILL_USE_LIB) + +########################################################################### +# Deduce other build variables from AXIS_BUILDTYPE. +ifdef AXIS_BUILDTYPE + +ifeq ($(AXIS_BUILDTYPE),cris-axis-linux-gnu) +CLINUX =3D 1 +AXIS_WILL_USE_LIB =3D GLIBC +endif =20 +ifeq ($(AXIS_BUILDTYPE),clinux) +CLINUX =3D 1 +AXIS_WILL_USE_LIB =3D UCLIBC +endif + +ifeq ($(AXIS_BUILDTYPE),elinux) +ELINUX =3D 1 +AXIS_WILL_USE_LIB =3D UCLIBC +endif + +ifeq ($(AXIS_BUILDTYPE),host) +HOST =3D 1 +endif + +# Has this ever been used? What's the difference to "host"? +ifeq ($(AXIS_BUILDTYPE),linux) +LINUX =3D 1 +endif +endif # AXIS_BUILDTYPE + ########################################################################### =20 ifdef ELINUX @@ -25,30 +74,104 @@ CPP =3D gcc_cris -melinux -E CXX =3D gcc_cris -melinux -xc++ =20 -LDFLAGS =3D -s -symbolic +LDFLAGS =3D -s -shlib =20 TARGET_TYPE =3D elinux CRIS =3D 1 -endif =20 +# ELINUX always uses uclibc. Though a check that the app can use uclibc +# is in order. +ifndef USE_UCLIBC + +ifdef AXIS_USABLE_LIBS +ifneq ($(filter $(AXIS_USABLE_LIBS),UCLIBC),UCLIBC) +$(error $(AXIS_ERROR_PREFIX) $(AXIS_LIB_MISMATCH)) +else +# Define legacy macro. +USE_UCLIBC =3D 1 +endif # not UCLIBC in AXIS_USABLE_LIBS +endif # AXIS_USABLE_LIBS + +else +$(warning $(AXIS_WARNING_PREFIX) $(AXIS_USE_UCLIBC_DEPRECATED)) +endif # not USE_UCLIBC +endif # ELINUX + ifdef CLINUX -# Same as ELINUX but with different options (to build as ELF) -# Linux/CRIS does only support statically linked exes currently -# so use -static and not -symbolic + +ifndef ELINUXDIR +ELINUXDIR :=3D $(shell echo `pwd`/../os/linux) +endif + +# Here we will check AXIS_WILL_USE_LIB against AXIS_USABLE_LIBS which +# represents what the thing we want to compile can be linked with. If +# library and compile variable settings (like CC) aren't supposed to be +# set or are not applicable, then AXIS_USABLE_LIBS should not be set. + +# First some backwards compatibility: each app used to set USE_UCLIBC in +# its makefile. +ifdef USE_UCLIBC +$(warning $(AXIS_WARNING_PREFIX) $(AXIS_USE_UCLIBC_DEPRECATED)) +AXIS_USABLE_LIBS +=3D UCLIBC +# Let's unset the original var to fall in line with expected case. +USE_UCLIBC =3D +endif + +ifdef AXIS_USABLE_LIBS +ifneq ($(filter $(AXIS_USABLE_LIBS),$(AXIS_WILL_USE_LIB)),$(AXIS_WILL_USE_= LIB)) +$(error $(AXIS_ERROR_PREFIX) $(AXIS_LIB_MISMATCH)) +endif +endif # AXIS_USABLE_LIBS + +# Set legacy variables used in various unknown Makefiles. +# FIXME: Kill the USE_* variables when all apps are changed to use +# AXIS_WILL_USE_LIB instead. Until then, introduce no new use or setting +# of USE_*. +ifeq ($(AXIS_WILL_USE_LIB),GLIBC) +USE_GLIBC =3D 1 +else # AXIS_WILL_USE_LIB !=3D GLIBC (i.e. currently implying UCLIBC). +ifeq ($(AXIS_WILL_USE_LIB),UCLIBC) +USE_UCLIBC =3D 1 +else +$(error $(AXIS_ERROR_PREFIX) Unexpected library $(AXIS_WILL_USE_LIB).) +endif +endif # AXIS_WILL_USE_LIB !=3D GLIBC + +# Now that we've checked that AXIS_WILL_USE_LIB matches AXIS_USABLE_LIBS, +# we set the other build vars. + +ifeq ($(AXIS_WILL_USE_LIB),UCLIBC) +# Same as ELINUX but with different options (to build as ELF), and we +# build statically since uclibc does not support dynamic linking. =20 CC =3D gcc_cris -mlinux -DCRISMMU CPP =3D gcc_cris -mlinux -DCRISMMU -E CXX =3D gcc_cris -mlinux -DCRISMMU -xc++ =20 LDFLAGS =3D -s -static +endif # AXIS_WILL_USE_LIB =3D UCLIBC + +ifeq ($(AXIS_WILL_USE_LIB),GLIBC) +# Using glibc, linking dynamically like on the host. + +# We prefer getting <asm/...> and <linux/...> from the kernel we compile, +# rather than what was installed with the compiler, so put it first in the +# system include path. =20 +CC =3D gcc-cris -mlinux -isystem $(ELINUXDIR)/include +CPP =3D gcc-cris -mlinux -E -isystem $(ELINUXDIR)/include +CXX =3D g++-cris -mlinux -xc++ -isystem $(ELINUXDIR)/include +LDFLAGS =3D -s -L$(prefix)/lib +endif # AXIS_WILL_USE_LIB !=3D GLIBC + TARGET_TYPE =3D clinux CRIS =3D 1 -endif =20 +endif # CLINUX + ifdef CRIS =20 -# This is for building for the cris architecture +# This is for building for the CRIS architecture. =20 OBJCOPY =3D objcopy-cris LD =3D ld-cris @@ -65,7 +188,7 @@ =20 else =20 -# This is for building for the local host +# This is for building for the local host. =20 RANLIB =3D ranlib =20 @@ -78,31 +201,29 @@ endif # HROOT run_prefix =3D $(prefix) =20 -endif +endif # not CRIS =20 INSTALL =3D install =20 ########################################################################### =20 -# Define CFLAGS to something sensible -CFLAGS =3D -O2 -Wall +# Define CFLAGS to something sensible. +CFLAGS =3D -Wall =20 ifdef CRIS -# Sorry; only -Dlinux is built-in. __linux__ will be defined in -# gcc-cris & Co R26. -CFLAGS +=3D -D__linux__ - +CFLAGS +=3D -O2 ifdef ELINUX CFLAGS +=3D -DELINUX endif =20 else -# We want to be able to use gdb with full debug info for host compiled pro= grams -CFLAGS +=3D -g +# We want to be able to use gdb with full debug info for host compiled +# programs. +CFLAGS +=3D -O0 -g endif =20 -# Can't use -pedantic due to use of long long in standard includes :( -CXXFLAGS =3D $(CFLAGS) -Wno-ctor-dtor-privacy -ansi -pipe -fcheck-new +# Can't use -pedantic due to use of long long in standard includes. :( +CXXFLAGS =3D $(CFLAGS) -Wno-ctor-dtor-privacy -ansi -pipe =20 # An elinux program is expected to be compiled like this: # $(CC) $(CFLAGS) -c my_file.c @@ -113,7 +234,9 @@ # $(CC) $(LDFLAGS) -o my_program my_file.o possibly_other_objects.o =20 ifdef CRIS -ifdef USE_UCLIBC +ifeq ($(AXIS_WILL_USE_LIB),UCLIBC) +# FIXME: Delete the UCLIBC macro once all usage is exterminated. Usage +# should be of if[n]eq ($(AXIS_WILL_USE_LIB),UCLIBC). UCLIBC =3D 1 CC +=3D -muclibc=3D$(prefix) CPP +=3D -muclibc=3D$(prefix) @@ -125,42 +248,73 @@ # The following are a set of standard rules to try to make sure we build # and install the correct files. =20 -all: pre-all-recurse all-recurse +all: all-recurse +all-recurse: pre-all-recurse =20 # Make eroot a dependency of all install rules to make sure the $(prefix) # variable is set (to $HROOT or $EROOT depending on whether this # is a build for the host or elinux). -depend: eroot pre-depend-recurse depend-recurse -install: eroot pre-install-recurse install-recurse +depend: depend-recurse +depend-recurse: pre-depend-recurse +pre-depend-recurse: eroot=20 =20 -uninstall: pre-uninstall-recurse uninstall-recurse +install: install-recurse +install-recurse: pre-install-recurse=20 +pre-install-recurse: eroot =20 -clean: pre-clean-recurse clean-recurse +uninstall: uninstall-recurse +uninstall-recurse: pre-uninstall-recurse +pre-uninstall-recurse: eroot =20 -# Used to change the target for the build. -elinux: pre-elinux-recurse elinux-recurse -clinux: pre-clinux-recurse clinux-recurse -host: pre-host-recurse host-recurse -elinux clinux host: - @if test ! -f .target_$@ ; then \ - NO_SUBDIR_RECURSION=3D1 $(MAKE) --no-print-directory clean; \ +clean: clean-recurse +clean-recurse: pre-clean-recurse + +ifndef ROOT_MAKEFRAG +ROOT_MAKEFRAG :=3D $(shell echo `pwd`/$(makefrag_name)) + +# This rule allows old .target_* files to be converted to .target-makefrag +# by running make configsubs in the root directory +$(ROOT_MAKEFRAG): +ifdef AXIS_BUILDTYPE + $(MAKE) $(AXIS_BUILDTYPE) +else + @echo "You must specify the target type!" + exit 1 +endif +endif # !ROOT_MAKEFRAG + +cris-axis-linux-gnu elinux clinux host: + echo AXIS_BUILDTYPE=3D$@ > .tmp$(makefrag_name) + -$(MAKE) configsubs AXIS_BUILDTYPE=3D$@ ROOT_MAKEFRAG=3D$(shell echo `pwd= `/.tmp$(makefrag_name)) + @rm -f .tmp$(makefrag_name) + +checkclean: + @if ! test -f .target_$(AXIS_BUILDTYPE) \ + && ( ! test -f $(makefrag_name) \ + || ! grep AXIS_BUILDTYPE=3D$(AXIS_BUILDTYPE) $(makefrag_name) > = /dev/null ); then \ + NO_SUBDIR_RECURSION=3D1 $(MAKE) --no-print-directory clean ROOT_MAKEFRA= G=3D$(ROOT_MAKEFRAG); \ fi - rm -rf .target_* - touch .target_$@ + +configsubs: configsubs-recurse +configsubs-recurse: pre-configsubs-recurse +pre-configsubs-recurse: $(ROOT_MAKEFRAG)=20 + +configsubs: checkclean + -cmp -s $(ROOT_MAKEFRAG) $(makefrag_name) || ( rm -f .target*; cp $(ROOT_= MAKEFRAG) $(makefrag_name) ) =20 # These are hooks that can be used to have rules executed before the -# recursive rules are checked -pre-all-recurse pre-depend-recurse pre-install-recurse pre-uninstall-recur= se pre-clean-recurse pre-elinux-recurse pre-clinux-recurse pre-host-recurse: +# recursive rules are checked. +pre-all-recurse pre-depend-recurse pre-install-recurse pre-uninstall-recur= se pre-clean-recurse pre-configsubs-recurse: =20 -# Recursive rules to make all, depend, install, uninstall, clean, elinux, -# clinux and host -all-recurse depend-recurse install-recurse uninstall-recurse clean-recurse= elinux-recurse clinux-recurse host-recurse: +# Recursive rules to make all, depend, install, uninstall, clean and +# configsubs. +all-recurse depend-recurse install-recurse uninstall-recurse clean-recurse= configsubs-recurse: @if test $(NO_SUBDIR_RECURSION)0 -eq 0 ; then \ for subdir in $(SUBDIRS); do \ if test -d $$subdir ; then \ target=3D`echo $@ | sed 's/-recurse//'`; \ - echo Making $$target in $$subdir; \ - (cd $$subdir && $(MAKE) $$target) || exit 1; \ + echo Making $$target in $$subdir for $(AXIS_BUILDTYPE); \ + $(MAKE) -C $$subdir $$target ROOT_MAKEFRAG=3D$(ROOT_MAKEFRAG) || ex= it 1; \ fi; \ done; \ fi |
From: Peter K. <pk...@us...> - 2001-08-16 13:12:47
|
The following file was modified in apps: Name Old version New version Comment ---- ----------- ----------- ------- Rules.elinux 1.3 1.4=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Synchronised with our latest version of this file. The diff of the modified file(s): --- Rules.elinux 2001/05/07 11:23:57 1.3 +++ Rules.elinux 2001/08/16 13:12:46 1.4 @@ -79,6 +79,14 @@ TARGET_TYPE =3D elinux CRIS =3D 1 =20 +# This is for compatibility with cris-dist-1.7, where a.out was the +# default, but which does not understand -mcrisaout. We'll only do the +# costly assignment if we don't inherit the value, which is a " " or +# -mcrisaout. +ifndef AXIS_LD_OUTPUT_FORMAT_OPTION +AXIS_LD_OUTPUT_FORMAT_OPTION :=3D $(shell `gcc-cris -print-prog-name=3Dld`= -V | sed -n -e 's/.* crisaout/-mcrisaout/p') # +endif + # ELINUX always uses uclibc. Though a check that the app can use uclibc # is in order. ifndef USE_UCLIBC @@ -148,7 +156,11 @@ CPP =3D gcc_cris -mlinux -DCRISMMU -E CXX =3D gcc_cris -mlinux -DCRISMMU -xc++ =20 -LDFLAGS =3D -s -static +LDFLAGS =3D -static +ifneq ($(AXIS_DEBUG),debug) +# Add -s flag for stripping if not building for debug. +LDFLAGS +=3D -s +endif # AXIS_DEBUG !=3D debug endif # AXIS_WILL_USE_LIB =3D UCLIBC =20 ifeq ($(AXIS_WILL_USE_LIB),GLIBC) @@ -156,17 +168,27 @@ =20 # We prefer getting <asm/...> and <linux/...> from the kernel we compile, # rather than what was installed with the compiler, so put it first in the -# system include path. +# system include path. Though we have to go through a separate directory +# with just the linux and asm dirs, rather than use $(ELINUXDIR)/include, +# lest we also drag in the other subdirs, which collide with the normal +# gcc-cris -mlinux system-includes, for example <net/...>. =20 -CC =3D gcc-cris -mlinux -isystem $(ELINUXDIR)/include -CPP =3D gcc-cris -mlinux -E -isystem $(ELINUXDIR)/include -CXX =3D g++-cris -mlinux -xc++ -isystem $(ELINUXDIR)/include -LDFLAGS =3D -s -L$(prefix)/lib +CC =3D gcc-cris -mlinux -isystem $(prefix)/include +CPP =3D gcc-cris -mlinux -E -isystem $(prefix)/include +CXX =3D g++-cris -mlinux -xc++ -isystem $(prefix)/include + +LDFLAGS =3D -L$(prefix)/lib +ifneq ($(AXIS_DEBUG),debug) +# Add -s flag for stripping if not building for debug. +LDFLAGS +=3D -s +endif # AXIS_DEBUG !=3D debug endif # AXIS_WILL_USE_LIB !=3D GLIBC =20 TARGET_TYPE =3D clinux CRIS =3D 1 =20 +AXIS_LD_OUTPUT_FORMAT_OPTION =3D -mcrislinux + endif # CLINUX =20 ifdef CRIS @@ -174,7 +196,7 @@ # This is for building for the CRIS architecture. =20 OBJCOPY =3D objcopy-cris -LD =3D ld-cris +LD =3D ld-cris $(AXIS_LD_OUTPUT_FORMAT_OPTION) AR =3D ar-cris RANLIB =3D ranlib-cris =20 @@ -212,6 +234,12 @@ =20 ifdef CRIS CFLAGS +=3D -O2 + +ifeq ($(AXIS_DEBUG),debug) +# Add suitable compiler flags for debugging. +CFLAGS +=3D -g -fno-omit-frame-pointer +endif +=20 ifdef ELINUX CFLAGS +=3D -DELINUX endif @@ -283,8 +311,22 @@ endif endif # !ROOT_MAKEFRAG =20 +nodebug: + grep -v AXIS_DEBUG $(makefrag_name) > $(makefrag_name).tmp + mv -f $(makefrag_name).tmp $(makefrag_name) + -$(MAKE) clean + +debug: + grep -v AXIS_DEBUG $(makefrag_name) >$(makefrag_name).tmp + echo AXIS_DEBUG=3Ddebug >>$(makefrag_name).tmp + mv -f $(makefrag_name).tmp $(makefrag_name) + -$(MAKE) clean + cris-axis-linux-gnu elinux clinux host: echo AXIS_BUILDTYPE=3D$@ > .tmp$(makefrag_name) + ifeq ($(AXIS_DEBUG),debug) + echo AXIS_DEBUG=3D$(AXIS_DEBUG) >> .tmp$(makefrag_name) + endif -$(MAKE) configsubs AXIS_BUILDTYPE=3D$@ ROOT_MAKEFRAG=3D$(shell echo `pwd= `/.tmp$(makefrag_name)) @rm -f .tmp$(makefrag_name) =20 |
From: Peter K. <pk...@us...> - 2001-10-21 10:39:12
|
The following file was modified in apps: Name Old version New version Comment ---- ----------- ----------- ------- Rules.elinux 1.4 1.5=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Synchronised with our latest version of this file. The diff of the modified file(s): --- Rules.elinux 2001/08/16 13:12:46 1.4 +++ Rules.elinux 2001/10/21 10:39:11 1.5 @@ -1,65 +1,108 @@ # Hey Emacs, this Makefile is in -*- makefile -*- mode! +## $Id$ + +# Try 'make axishelp' to display the possible targets =20 makefrag_name =3D .target-makefrag =20 +# Set VERBOSE_FRAG to nothing to print that stuff if you want it,=20 +# it clutters up the screen so it's @ by default. +VERBOSE_FRAG =3D @ + +# By default we do not build statically except for one target (clinux), +# but it can be enabled/disabled with the targets static and nostatic. +AXIS_STATIC =3D + +AXIS_WARNING_PREFIX =3D ---------- WARNING: +AXIS_ERROR_PREFIX =3D ---------- ERROR: +AXIS_USE_UCLIBC_DEPRECATED =3D Makefile in $(shell pwd) sets deprecated \ +USE_UCLIBC. It should set AXIS_USABLE_LIBS =3D UCLIBC +AXIS_LIB_MISMATCH =3D The code in $(shell pwd) cannot be linked with\ + $(AXIS_WILL_USE_LIB) + +# Help "function" to add slashes before spaces +slashify =3D $(shell echo "$(1)" | sed 's/ /\\ /g') + +########################################################################### +# Start by deciding what we are building for + ifndef AXIS_BUILDTYPE -# If we have a .target-makefrag, read stuff from it. Else we will -# probably create one, so define ROOT_MAKEFRAG. +# If we have a .target-makefrag, read stuff from it. ifeq ($(makefrag_name),$(wildcard $(makefrag_name))) include $(makefrag_name) endif # An $(makefrag_name) existing in current directory. =20 -# Backward compatibility with the old .target_* files. +# OBSOLETE: Backward compatibility with the old .target_* files. ifndef AXIS_BUILDTYPE ifeq (.target_elinux,$(wildcard .target_*)) +$(warning $(AXIS_WARNING_PREFIX) Use of .target_elinux is deprecated, and = support for it will be removed in the near future) AXIS_BUILDTYPE=3Delinux endif ifeq (.target_clinux,$(wildcard .target_*)) +$(warning $(AXIS_WARNING_PREFIX) Use of .target_clinux is deprecated, and = support for it will be removed in the near future) AXIS_BUILDTYPE=3Dclinux endif ifeq (.target_host,$(wildcard .target_*)) +$(warning $(AXIS_WARNING_PREFIX) Use of .target_host is deprecated, and su= pport for it will be removed in the near future) AXIS_BUILDTYPE=3Dhost endif endif =20 endif # !AXIS_BUILDTYPE =20 -SUBDIRS +=3D dummy -AXIS_WARNING_PREFIX =3D ---------- WARNING: -AXIS_ERROR_PREFIX =3D ---------- ERROR: -AXIS_USE_UCLIBC_DEPRECATED =3D Makefile in $(shell pwd) sets deprecated \ -USE_UCLIBC. It should set AXIS_USABLE_LIBS =3D UCLIBC -AXIS_LIB_MISMATCH =3D The code in $(shell pwd) cannot be linked with\ - $(AXIS_WILL_USE_LIB) +# Build for host if the build type is not defined. +ifndef AXIS_BUILDTYPE +AXIS_BUILDTYPE =3D host +endif =20 -########################################################################### +# Should we build with debug information or not? +ifeq ($(AXIS_DEBUG),debug) +AXIS_USE_DEBUG =3D yes +else +AXIS_USE_DEBUG =3D no +endif + +#-------------------------------------------------------------------------- + # Deduce other build variables from AXIS_BUILDTYPE. -ifdef AXIS_BUILDTYPE + +AXIS_BUILDTYPE_KNOWN =3D no =20 ifeq ($(AXIS_BUILDTYPE),cris-axis-linux-gnu) CLINUX =3D 1 AXIS_WILL_USE_LIB =3D GLIBC -endif +AXIS_BUILDTYPE_KNOWN =3D yes +endif # AXIS_BUILDTYPE =3D=3D cris-axis-linux-gnu =20 +ifeq ($(AXIS_BUILDTYPE),cris-axis-linux-gnuuclibc) +CLINUX =3D 1 +AXIS_WILL_USE_LIB =3D UCLIBC +AXIS_BUILDTYPE_KNOWN =3D yes +endif # AXIS_BUILDTYPE =3D=3D cris-axis-linux-gnuuclibc + ifeq ($(AXIS_BUILDTYPE),clinux) CLINUX =3D 1 AXIS_WILL_USE_LIB =3D UCLIBC -endif +# Default static +AXIS_STATIC =3D static +AXIS_BUILDTYPE_KNOWN =3D yes +endif # AXIS_BUILDTYPE =3D=3D clinux =20 ifeq ($(AXIS_BUILDTYPE),elinux) ELINUX =3D 1 AXIS_WILL_USE_LIB =3D UCLIBC -endif +AXIS_BUILDTYPE_KNOWN =3D yes +endif # AXIS_BUILDTYPE =3D=3D elinux =20 ifeq ($(AXIS_BUILDTYPE),host) HOST =3D 1 -endif - -# Has this ever been used? What's the difference to "host"? -ifeq ($(AXIS_BUILDTYPE),linux) -LINUX =3D 1 +# We want to be able to use gdb with full debug info for host compiled +# programs. +ifneq ($(AXIS_DEBUG),no) +AXIS_USE_DEBUG =3D yes endif -endif # AXIS_BUILDTYPE +AXIS_BUILDTYPE_KNOWN =3D yes +endif # AXIS_BUILDTYPE =3D=3D host =20 ########################################################################### =20 @@ -71,11 +114,7 @@ # include-files and have the right defines etc. so it should be # seen as part of CC rather than CFLAGS. CC =3D gcc_cris -melinux -CPP =3D gcc_cris -melinux -E -CXX =3D gcc_cris -melinux -xc++ =20 -LDFLAGS =3D -s -shlib - TARGET_TYPE =3D elinux CRIS =3D 1 =20 @@ -95,16 +134,20 @@ ifneq ($(filter $(AXIS_USABLE_LIBS),UCLIBC),UCLIBC) $(error $(AXIS_ERROR_PREFIX) $(AXIS_LIB_MISMATCH)) else -# Define legacy macro. +# OBSOLETE: Define legacy macro. USE_UCLIBC =3D 1 -endif # not UCLIBC in AXIS_USABLE_LIBS +endif # UCLIBC not in AXIS_USABLE_LIBS endif # AXIS_USABLE_LIBS =20 else +# OBSOLETE: If you get an error about missing separator here +# upgrade your make! $(warning $(AXIS_WARNING_PREFIX) $(AXIS_USE_UCLIBC_DEPRECATED)) -endif # not USE_UCLIBC +endif # !USE_UCLIBC endif # ELINUX =20 +#-------------------------------------------------------------------------- + ifdef CLINUX =20 ifndef ELINUXDIR @@ -116,8 +159,8 @@ # library and compile variable settings (like CC) aren't supposed to be # set or are not applicable, then AXIS_USABLE_LIBS should not be set. =20 -# First some backwards compatibility: each app used to set USE_UCLIBC in -# its makefile. +# OBSOLETE: First some backwards compatibility: each app used to set +# USE_UCLIBC in its makefile. ifdef USE_UCLIBC $(warning $(AXIS_WARNING_PREFIX) $(AXIS_USE_UCLIBC_DEPRECATED)) AXIS_USABLE_LIBS +=3D UCLIBC @@ -131,7 +174,7 @@ endif endif # AXIS_USABLE_LIBS =20 -# Set legacy variables used in various unknown Makefiles. +# OBSOLETE: Set legacy variables used in various unknown Makefiles. # FIXME: Kill the USE_* variables when all apps are changed to use # AXIS_WILL_USE_LIB instead. Until then, introduce no new use or setting # of USE_*. @@ -147,22 +190,13 @@ =20 # Now that we've checked that AXIS_WILL_USE_LIB matches AXIS_USABLE_LIBS, # we set the other build vars. - -ifeq ($(AXIS_WILL_USE_LIB),UCLIBC) -# Same as ELINUX but with different options (to build as ELF), and we -# build statically since uclibc does not support dynamic linking. =20 -CC =3D gcc_cris -mlinux -DCRISMMU -CPP =3D gcc_cris -mlinux -DCRISMMU -E -CXX =3D gcc_cris -mlinux -DCRISMMU -xc++ - -LDFLAGS =3D -static -ifneq ($(AXIS_DEBUG),debug) -# Add -s flag for stripping if not building for debug. -LDFLAGS +=3D -s -endif # AXIS_DEBUG !=3D debug -endif # AXIS_WILL_USE_LIB =3D UCLIBC +CC =3D gcc_cris -mlinux =20 +ifeq ($(AXIS_WILL_USE_LIB),UCLIBC) +# Same as ELINUX but with different options (to build as ELF). +CC +=3D -DCRISMMU +else ifeq ($(AXIS_WILL_USE_LIB),GLIBC) # Using glibc, linking dynamically like on the host. =20 @@ -173,16 +207,11 @@ # lest we also drag in the other subdirs, which collide with the normal # gcc-cris -mlinux system-includes, for example <net/...>. =20 -CC =3D gcc-cris -mlinux -isystem $(prefix)/include -CPP =3D gcc-cris -mlinux -E -isystem $(prefix)/include -CXX =3D g++-cris -mlinux -xc++ -isystem $(prefix)/include - -LDFLAGS =3D -L$(prefix)/lib -ifneq ($(AXIS_DEBUG),debug) -# Add -s flag for stripping if not building for debug. -LDFLAGS +=3D -s -endif # AXIS_DEBUG !=3D debug -endif # AXIS_WILL_USE_LIB !=3D GLIBC +CC +=3D -isystem $(prefix)/include +else +$(error $(AXIS_ERROR_PREFIX) Unexpected library $(AXIS_WILL_USE_LIB).) +endif # AXIS_WILL_USE_LIB =3D GLIBC +endif # AXIS_WILL_USE_LIB =3D UCLIBC =20 TARGET_TYPE =3D clinux CRIS =3D 1 @@ -191,8 +220,20 @@ =20 endif # CLINUX =20 +#-------------------------------------------------------------------------- + ifdef CRIS =20 +ifeq ($(AXIS_WILL_USE_LIB),UCLIBC) +# OBSOLETE: Delete the UCLIBC macro once all usage is exterminated. Usage +# should be of if[n]eq ($(AXIS_WILL_USE_LIB),UCLIBC). +UCLIBC =3D 1 +CC +=3D -muclibc=3D$(prefix) +endif + +CPP =3D $(CC) -E +CXX =3D $(CC) -xc++ + # This is for building for the CRIS architecture. =20 OBJCOPY =3D objcopy-cris @@ -200,12 +241,6 @@ AR =3D ar-cris RANLIB =3D ranlib-cris =20 -TARGET_ENV =3D "\$$EROOT" -ifdef EROOT -ifndef prefix -prefix =3D $(EROOT) -endif # prefix -endif # EROOT run_prefix =3D=20 =20 else @@ -214,85 +249,103 @@ =20 RANLIB =3D ranlib =20 -TARGET_TYPE =3D host -TARGET_ENV =3D "\$$HROOT" -ifdef HROOT -ifndef prefix -prefix =3D $(HROOT) -endif # prefix -endif # HROOT run_prefix =3D $(prefix) =20 -endif # not CRIS +endif # !CRIS =20 -INSTALL =3D install +#-------------------------------------------------------------------------- =20 -########################################################################### +ifndef prefix +ifdef AXIS_TOP_DIR +prefix =3D $(AXIS_TOP_DIR)/target/$(AXIS_BUILDTYPE) +else +# OBSOLETE: The $(EROOT) and $(HROOT) variables should not be used any mor= e. +ifdef CRIS +ifdef EROOT +prefix =3D $(EROOT) +$(warning $(AXIS_WARNING_PREFIX) Use of $$EROOT is deprecated! Please use = $$AXIS_TOP_DIR instead) +endif +else +ifdef HROOT +prefix =3D $(HROOT) +$(warning $(AXIS_WARNING_PREFIX) Use of $$HROOT is deprecated! Please use = $$AXIS_TOP_DIR instead) +endif=20 +endif # CRIS +endif # AXIS_TOP_DIR +endif # !prefix =20 +#-------------------------------------------------------------------------- + # Define CFLAGS to something sensible. CFLAGS =3D -Wall - -ifdef CRIS -CFLAGS +=3D -O2 =20 -ifeq ($(AXIS_DEBUG),debug) +ifeq ($(AXIS_USE_DEBUG),yes) # Add suitable compiler flags for debugging. -CFLAGS +=3D -g -fno-omit-frame-pointer +CFLAGS +=3D -O0 -g -fno-omit-frame-pointer +else +CFLAGS +=3D -O2 endif =20=20 +# OBSOLETE: Add ELINUX define. ifdef ELINUX CFLAGS +=3D -DELINUX endif =20 -else -# We want to be able to use gdb with full debug info for host compiled -# programs. -CFLAGS +=3D -O0 -g -endif - # Can't use -pedantic due to use of long long in standard includes. :( CXXFLAGS =3D $(CFLAGS) -Wno-ctor-dtor-privacy -ansi -pipe =20 -# An elinux program is expected to be compiled like this: -# $(CC) $(CFLAGS) -c my_file.c -# I don't know if C++ works as "expected" in elinux, but in -# theory it could be compiled like this: -# $(CXX) $(CXXFLAGS) -c my_file.cc -# And all objects should be linked like this: -# $(CC) $(LDFLAGS) -o my_program my_file.o possibly_other_objects.o +# Define LDFLAGS to something sensible. +LDFLAGS =3D =20 -ifdef CRIS -ifeq ($(AXIS_WILL_USE_LIB),UCLIBC) -# FIXME: Delete the UCLIBC macro once all usage is exterminated. Usage -# should be of if[n]eq ($(AXIS_WILL_USE_LIB),UCLIBC). -UCLIBC =3D 1 -CC +=3D -muclibc=3D$(prefix) -CPP +=3D -muclibc=3D$(prefix) -CXX +=3D -muclibc=3D$(prefix) +ifeq ($(AXIS_WILL_USE_LIB),GLIBC) +LDFLAGS +=3D -L$(prefix)/lib +endif + +# Add -s flag for stripping if not building for debug. (The -s flag must n= ot +# be specified when building statically for elinux, however.) +ifneq ($(AXIS_USE_DEBUG),yes) +ifneq ($(AXIS_STATIC),static) +LDFLAGS +=3D -s +else +ifndef ELINUX +LDFLAGS +=3D -s endif endif +endif # AXIS_USE_DEBUG !=3D yes =20 -#-------------------------------------------------------------------------- -# The following are a set of standard rules to try to make sure we build +ifeq ($(AXIS_STATIC),static) +LDFLAGS +=3D -static +else +ifdef ELINUX +LDFLAGS +=3D -shlib +endif +endif # AXIS_STATIC =3D static + +INSTALL =3D install + +########################################################################### +# The following is a set of standard rules to try to make sure we build # and install the correct files. =20 +# Make verify_builddir a dependency of all build and install rules to make +# sure the build directory is set correctly before trying to actually build +# anything. + all: all-recurse all-recurse: pre-all-recurse +pre-all-recurse: verify_builddir =20 -# Make eroot a dependency of all install rules to make sure the $(prefix) -# variable is set (to $HROOT or $EROOT depending on whether this -# is a build for the host or elinux). depend: depend-recurse depend-recurse: pre-depend-recurse -pre-depend-recurse: eroot=20 +pre-depend-recurse: verify_builddir =20 install: install-recurse install-recurse: pre-install-recurse=20 -pre-install-recurse: eroot +pre-install-recurse: verify_builddir =20 uninstall: uninstall-recurse uninstall-recurse: pre-uninstall-recurse -pre-uninstall-recurse: eroot +pre-uninstall-recurse: verify_builddir =20 clean: clean-recurse clean-recurse: pre-clean-recurse @@ -300,9 +353,9 @@ ifndef ROOT_MAKEFRAG ROOT_MAKEFRAG :=3D $(shell echo `pwd`/$(makefrag_name)) =20 -# This rule allows old .target_* files to be converted to .target-makefrag -# by running make configsubs in the root directory -$(ROOT_MAKEFRAG): +# OBSOLETE: This rule allows old .target_* files to be converted to +# .target-makefrag by running make configsubs in the root directory +$(call slashify,$(ROOT_MAKEFRAG)): ifdef AXIS_BUILDTYPE $(MAKE) $(AXIS_BUILDTYPE) else @@ -311,59 +364,99 @@ endif endif # !ROOT_MAKEFRAG =20 -nodebug: - grep -v AXIS_DEBUG $(makefrag_name) > $(makefrag_name).tmp - mv -f $(makefrag_name).tmp $(makefrag_name) - -$(MAKE) clean +##=20 +## The following special targets exists: =20 -debug: - grep -v AXIS_DEBUG $(makefrag_name) >$(makefrag_name).tmp - echo AXIS_DEBUG=3Ddebug >>$(makefrag_name).tmp - mv -f $(makefrag_name).tmp $(makefrag_name) - -$(MAKE) clean +## axishelp - This help +axishelp: + @grep '^## ' $(APPS)/Rules.elinux =20 -cris-axis-linux-gnu elinux clinux host: - echo AXIS_BUILDTYPE=3D$@ > .tmp$(makefrag_name) +##=20 +## The following build types exist: +## cris-axis-linux-gnu - CRIS/Linux 2.4 with shared glibc +## cris-axis-linux-gnuuclibc - CRIS/Linux 2.4 with shared uClibc +## clinux - CRIS/Linux 2.4 with static uClibc +## elinux - CRIS/Linux 2.0 NO_MMU with uC-libc +## host - Host build with debug +cris-axis-linux-gnu cris-axis-linux-gnuuclibc clinux elinux host: + $(VERBOSE_FRAG)echo AXIS_BUILDTYPE=3D$@ > .tmp$(makefrag_name) ifeq ($(AXIS_DEBUG),debug) - echo AXIS_DEBUG=3D$(AXIS_DEBUG) >> .tmp$(makefrag_name) + $(VERBOSE_FRAG)echo AXIS_DEBUG=3D$(AXIS_DEBUG) >> .tmp$(makefrag_name) endif - -$(MAKE) configsubs AXIS_BUILDTYPE=3D$@ ROOT_MAKEFRAG=3D$(shell echo `pwd= `/.tmp$(makefrag_name)) + @$(MAKE) configsubs AXIS_BUILDTYPE=3D$@ ROOT_MAKEFRAG=3D"$(shell echo `pw= d`/.tmp$(makefrag_name))" || ( rm -f .tmp$(makefrag_name); exit 1 ) + @rm -f .tmp$(makefrag_name) + +##=20 +## The following build options exist: +## debug - Enable debug +## nodebug - Do not enable debug +## static - Enable static linking +## nostatic - Do not enable static linking +debug nodebug static nostatic: + @option=3D`echo $@ | sed 's/^no//'`;\ + target=3D`echo AXIS_$$option | tr a-z A-Z`;\ + grep -v "$$target" $(makefrag_name) > .tmp$(makefrag_name) 2> /dev/null; \ + if test "$$option" =3D=3D "$@"; then \ + echo $$target=3D$@ >> .tmp$(makefrag_name); \ + neg_check=3D'!'; \ + fi; \ + $(MAKE) configsubs AXIS_CHECK_STRING=3D"$$target=3D$$option" AXIS_NEG_CHE= CK=3D$$neg_check ROOT_MAKEFRAG=3D"$(shell echo `pwd`/.tmp$(makefrag_name))"= || ( rm -f .tmp$(makefrag_name); exit 1 ) @rm -f .tmp$(makefrag_name) =20 +ifndef AXIS_CHECK_STRING +AXIS_CHECK_STRING =3D "AXIS_BUILDTYPE=3D$(AXIS_BUILDTYPE)" +AXIS_NEG_CHECK =3D ! +endif + checkclean: @if ! test -f .target_$(AXIS_BUILDTYPE) \ && ( ! test -f $(makefrag_name) \ - || ! grep AXIS_BUILDTYPE=3D$(AXIS_BUILDTYPE) $(makefrag_name) > = /dev/null ); then \ - NO_SUBDIR_RECURSION=3D1 $(MAKE) --no-print-directory clean ROOT_MAKEFRA= G=3D$(ROOT_MAKEFRAG); \ + || $(AXIS_NEG_CHECK) grep $(AXIS_CHECK_STRING) $(makefrag_name) = > /dev/null ); then \ + NO_SUBDIR_RECURSION=3D1 $(MAKE) --no-print-directory clean ROOT_MAKEFRA= G=3D"$(ROOT_MAKEFRAG)"; \ fi =20 configsubs: configsubs-recurse configsubs-recurse: pre-configsubs-recurse -pre-configsubs-recurse: $(ROOT_MAKEFRAG)=20 +pre-configsubs-recurse: $(call slashify,$(ROOT_MAKEFRAG)) =20 configsubs: checkclean - -cmp -s $(ROOT_MAKEFRAG) $(makefrag_name) || ( rm -f .target*; cp $(ROOT_= MAKEFRAG) $(makefrag_name) ) + -@if ! cmp -s "$(ROOT_MAKEFRAG)" $(makefrag_name); then \ + rm -f .target*; \ + echo "cp \"$(ROOT_MAKEFRAG)\" $(makefrag_name)"; \ + cp "$(ROOT_MAKEFRAG)" $(makefrag_name); \ + fi =20 # These are hooks that can be used to have rules executed before the # recursive rules are checked. pre-all-recurse pre-depend-recurse pre-install-recurse pre-uninstall-recur= se pre-clean-recurse pre-configsubs-recurse: =20 -# Recursive rules to make all, depend, install, uninstall, clean and -# configsubs. +# Recursive rules to make all, depend, install, uninstall, clean and confi= gsubs all-recurse depend-recurse install-recurse uninstall-recurse clean-recurse= configsubs-recurse: - @if test $(NO_SUBDIR_RECURSION)0 -eq 0 ; then \ - for subdir in $(SUBDIRS); do \ - if test -d $$subdir ; then \ +ifneq ($(NO_SUBDIR_RECURSION),1) + @subdirs=3D"$(SUBDIRS)"; \ + for subdir in $$subdirs; do \ + if test -d "$$subdir"; then \ target=3D`echo $@ | sed 's/-recurse//'`; \ - echo Making $$target in $$subdir for $(AXIS_BUILDTYPE); \ - $(MAKE) -C $$subdir $$target ROOT_MAKEFRAG=3D$(ROOT_MAKEFRAG) || ex= it 1; \ + echo "Making $$target in $$subdir for $(AXIS_BUILDTYPE)"; \ + $(MAKE) -C "$$subdir" $$target ROOT_MAKEFRAG=3D"$(ROOT_MAKEFRAG)" || = exit 1; \ + else \ + echo "The directory '$$subdir' does not exist or is not a directory!"= ; \ + exit 1; \ fi; \ - done; \ - fi + done +endif =20 -eroot: +verify_builddir: verify_buildtype ifndef prefix - @echo "You must define the environment variable $(TARGET_ENV) to where yo= ur $(TARGET_TYPE)" - @echo "applications should be installed!" + @echo "You must define either the environment variable \$$AXIS_TOP_DIR to= where your" + @echo "source tree is located, or \$$prefix to where anything (independen= t of target" + @echo "type) should be installed!" + @exit 1 +endif + +verify_buildtype: +ifneq ($(AXIS_BUILDTYPE_KNOWN),yes) + @echo "Unknown build type '$(AXIS_BUILDTYPE)'!" + @echo "Use 'make axishelp' to get a list of valid build types." @exit 1 endif |