|
version 1.56, 2005/11/08 03:11:54
|
version 1.57, 2006/01/27 05:04:57
|
|
|
|
| ## 'BUILD' and Make.conf, NOT this Makefile. ## | ## 'BUILD' and Make.conf, NOT this Makefile. ## |
| ######################################################## | ######################################################## |
| | |
| |
|
| ## Sets user-modifiable variables | ## Sets user-modifiable variables |
| ## e.g. enable TOS, Kernel, native kernel headers, etc | ## e.g. enable TOS, Kernel, native kernel headers, etc |
| include Make.conf | include Make.conf |
| ifeq ($(strip $(USE_CONFIGURE)), 1) |
|
| include config.make |
|
| endif |
|
| |
|
| ## USE_DEVFS. This flag causes the FUSD kernel module to build with |
|
| ## devfs support. DevFS seems to have race conditions and we do not |
|
| ## recommend using it |
|
| USE_DEVFS := 0 |
|
| |
|
| ## |
|
| ## If you are using shared libraries, you can turn off the following |
|
| ## flag to cause EmStar to use relative paths to discover its shared |
|
| ## libs. This is not generally recommended -- using LD_LIBRARY_PATH |
|
| ## is a better idea. |
|
| ## |
|
| REQUIRE_LD_LIBRARY_PATH := 1 |
|
| |
|
| ######################################################## |
|
| ## |
|
| ## Set various TinyOS related environment variables. |
|
| ## |
|
| ## *** WARNING: Changing the settings below is not |
|
| ## recommended because it does not generally work! |
|
| ## Use symlinks instead!! |
|
| ## |
|
| ## Please see <http://cvs.cens.ucla.edu/emstar/install.html> |
|
| ## for more detailed information. |
|
| ## |
|
| ## NOTE: If you want to configure EmStar to use other |
|
| ## locations for tinyos or tos-contrib, simply move |
|
| ## away the bundled versions and add symlinks to |
|
| ## the locations of the versions you want to use. |
|
| ## |
|
| ## We recommend this approach because using environment |
|
| ## variables is more fragile and harder to track with |
|
| ## revision control. |
|
| ## |
|
| ## The BUILD rules in EmStar are all coded to be relative |
|
| ## to the EmStar tree, and assume that tinyos and tos-contrib |
|
| ## are linked from inside it, or are present there. |
|
| ## Lots of things will break horribly if this is not the |
|
| ## case. |
|
| ## |
|
| ######################################################## |
|
| |
|
| ## TOSDIR points to the SourceForge TinyOS repo. |
|
| ## This setting points to the version bundled with EmStar |
|
| TOSDIR := $(PWD)/tinyos-1.x/tos |
|
| |
|
| ## TOS_CONTRIB points to the CENS tos-contrib repo |
|
| ## This setting points to the version checked out with EmStar |
|
| TOS_CONTRIB := $(PWD)/tos-contrib/ |
|
| |
|
| ## MAKERULES controls aspects of the TOS build system |
|
| ## This setting should be compatible with your TOSDIR setting |
|
| MAKERULES := $(TOSDIR)/../tools/make/Makerules |
|
| |
|
| ######################################################### |
|
| ######################################################### |
|
| | |
| # enable/disable DevFS |
ifeq ($(ARCH),) |
| ifeq ($(strip $(USE_DEVFS)),1) |
IS_NATIVE=1 |
| DEVFS_KCFLAG := -DUSE_DEVFS |
|
| else |
|
| DEVFS_KCFLAG := |
|
| endif | endif |
| | |
| ######################################################### |
include make/make.tinyos |
| ######################################################### |
|
| | |
| # Set platform-dependent variables. Including this fragment sets: | # Set platform-dependent variables. Including this fragment sets: |
| # ARCH -- the target architecture (e.g., arm-linux or i686-linux) | # ARCH -- the target architecture (e.g., arm-linux or i686-linux) |
| # NATIVE_ARCH -- the architecture we're compiling under | # NATIVE_ARCH -- the architecture we're compiling under |
| # CC, CPP, AR, LD, BINSTRIP -- paths to various utils | # CC, CPP, AR, LD, BINSTRIP -- paths to various utils |
| include make/make.platform | include make/make.platform |
| |
|
| # If shared libraries are in use, config the suffix to .so |
|
| ifeq ($(strip $(USE_SHARED)),1) |
|
| LIB_SUFFIX := .so |
|
| ifeq ($(strip $(REQUIRE_LD_LIBRARY_PATH)),0) |
|
| SHARED_LIB_PREFIX := lib/ |
|
| endif |
|
| else |
|
| LIB_SUFFIX := .a |
|
| endif |
|
| |
|
| # phread a dependency of glib (though we don't generally use it) |
|
| LDFLAGS += -lm -lpthread $(GLIB_PATH) |
|
| |
|
| # names of various target directories |
|
| OBJDIR := obj.$(ARCH) | OBJDIR := obj.$(ARCH) |
| NATIVE_OBJDIR := obj.$(NATIVE_ARCH) |
|
| BUILDDIR := .build |
|
| INCDIR := include |
|
| |
|
| # figure out if a cvs tag has been used here |
|
| CVSTAG := $(shell make/get-cvs-tag.pl) |
|
| |
|
| # default compiler and linker flags used by everything |
|
| # NOTE: some platform-specific flags might be set in make.platform |
|
| ifndef NO_PIC |
|
| CFLAGS += -fPIC |
|
| CXXFLAGS += -fPIC |
|
| endif |
|
| |
|
| # Set up cflags for stuff that's going in a library and stuff |
|
| # that's going in an executable... |
|
| ifeq ($(strip $(DEBUG_LIBS)),1) |
|
| CFLAGS_LIBS += -g |
|
| endif |
|
| ifeq ($(strip $(DEBUG_EXES)),1) |
|
| CFLAGS_EXES += -g |
|
| endif |
|
| |
|
| CFLAGS += -Wall -Werror -I. $(GLIB_CFLAGS) -I$(INCDIR) -DCVSTAG=\"$(CVSTAG)\" |
|
| KCFLAGS += -DCVSTAG=\"$(CVSTAG)\" |
|
| CXXFLAGS += -Wall -Werror -I. $(GLIB_CFLAGS) -I$(INCDIR) -DCVSTAG=\"$(CVSTAG)\" |
|
| |
|
| # path to find the automatically generated rules |
|
| RULES := $(OBJDIR)/$(BUILDDIR)/easybuild.rules |
|
| |
|
| # export some variables to be picked up by sub-makes |
|
| export PKG_CONFIG_PATH |
|
| export USE_SHARED |
|
| |
|
| # export some variables needed for TOS integration |
|
| export EMSTAR_MAKE=1 |
|
| export EMSTAR_ROOT = $(PWD) |
|
| export TOSDIR |
|
| export TOS_CONTRIB |
|
| export MAKERULES |
|
| PATH += :$(NESC_DIR)/bin:$(AVR_DIR)/bin |
|
| export PATH |
|
| export EMTOS_MAKE_OBJDIR = $(OBJDIR) |
|
| export EMTOS_MAKE_CC = $(CC) |
|
| export EMTOS_MAKE_GCCINCLUDE |
|
| export GLIB_CFLAGS |
|
| # set up the default location for the cross-compiled glib library |
|
| ifndef EMTOS_MAKE_LDFLAGS |
|
| EMTOS_MAKE_LDFLAGS = $(PWD)/$(GLIB_PATH) |
|
| endif |
|
| EMTOS_MAKE_LDFLAGS += -lpthread |
|
| export EMTOS_MAKE_LDFLAGS |
|
| |
|
| # setup stuff for 2.6 on kfusd |
|
| ifeq ($(strip $(BUILD_KMODULES)),1) |
|
| ifeq ($(strip $(BUILD_KMODULES_26)),1) |
|
| FUSD_26 := $(OBJDIR)/fusd/kfusd.ko |
|
| endif |
|
| endif |
|
| | |
| # the default target | # the default target |
| .DEFAULT default: $(RULES) default-targets $(FUSD_26) |
.DEFAULT default: |
| |
@make -f Makefile.main $0 |
| | |
| # clean target: delete all generated files |
|
| clean: | clean: |
| rm -rf ./$(OBJDIR)/$(BUILDDIR) |
if [[ ! ( . -ef ./$(OBJDIR) ) ]] ; then rm -rf ./$(OBJDIR) ; fi |
| rm -f $(ALL_TARGETS) $(RULES) |
ifeq ($(strip $(IS_NATIVE)), 1) |
| rm -f config.make | rm -f config.make |
| |
rm -f make/config.h |
| # strip target: strips all binaries other than kernel modules |
endif |
| strip: default-targets |
|
| @echo Stripping all binaries... |
|
| @$(BINSTRIP) $(ALL_STRIP_TARGETS) |
|
| |
|
| ## |
|
| ## If TinyOS not present, download it |
|
| ## |
|
| |
|
| # Include that causes tinyos to download |
|
| include tinyos-1.x/.force |
|
| |
|
| tinyos-1.x/.force: |
|
| @if [[ -d tinyos-1.x ]]; then \ |
|
| echo **** Using TinyOS installation that is already there... ; \ |
|
| else \ |
|
| echo TinyOS installation not found! ; \ |
|
| echo Downloading and installing TinyOS-1.x from EmStar website... ; \ |
|
| wget http://cvs.cens.ucla.edu/emstar-platforms/tinyos-1.1.13-linked.tgz -O - | tar -xzf - ; \ |
|
| fi |
|
| touch tinyos-1.x/.force |
|
| |
|
| # Include rules to build the "easybuild" system itself |
|
| include make/make.easybuild |
|
| |
|
| # Include the rules automatically generated by easybuild |
|
| include $(RULES) |
|
| |
|
| # And, finally, a rule to invoke easybuild. The rules should be |
|
| # regenerated if any of three things change: 1) the root BUILD file in |
|
| # this directory; 2) any of the BUILD files that are recursively read |
|
| # by easybuild (this list is in the BUILD_LIST variable, which is set |
|
| # by easybuild and written in .easybuild.rules); or, 3) the easybuild |
|
| # program itself. |
|
| $(RULES): BUILD $(BUILD_LIST) $(NATIVE_OBJDIR)/make/easybuild |
|
| @mkdir -p $(OBJDIR)/$(BUILDDIR) |
|
| $(NATIVE_OBJDIR)/make/easybuild > $@ || (rm -f $@; exit 1) |
|
| | |
| ## | ## |
| ## The 'help' target. | ## The 'help' target. |
|
|
|
| @echo " PKG_CONFIG_PATH=$(PKG_CONFIG_PATH)" | @echo " PKG_CONFIG_PATH=$(PKG_CONFIG_PATH)" |
| @echo " GLIB_PATH=$(GLIB_PATH)" | @echo " GLIB_PATH=$(GLIB_PATH)" |
| @echo " USE_SHARED='$(USE_SHARED)'" | @echo " USE_SHARED='$(USE_SHARED)'" |
| @echo " USE_DEVFS='$(USE_DEVFS)'" |
|
| @echo " BUILD_EMTOS='$(BUILD_EMTOS)'" | @echo " BUILD_EMTOS='$(BUILD_EMTOS)'" |
| @echo " TOSDIR=$(TOSDIR)" | @echo " TOSDIR=$(TOSDIR)" |
| @echo " TOS_CONTRIB=$(TOS_CONTRIB)" | @echo " TOS_CONTRIB=$(TOS_CONTRIB)" |
|
|
|
| @echo " NESC_DIR=$(NESC_DIR)" | @echo " NESC_DIR=$(NESC_DIR)" |
| @echo " AVR_DIR=$(AVR_DIR)" | @echo " AVR_DIR=$(AVR_DIR)" |
| | |
| KERNELVERSION := $(shell uname -r) |
|
| KVERS_MAJOR := $(shell uname -r | cut -d . -f 2) |
|
| # Installs kfusd and fusdd. Must be done as root! |
|
| install-fusd: default |
|
| @echo "You must be root for this to work!!!" |
|
| @echo "Copying module kfusd... " |
|
| mkdir -p /lib/modules/$(KERNELVERSION)/kernel/misc |
|
| ifeq ($(strip $(KVERS_MAJOR)),6) |
|
| cp -f $(OBJDIR)/fusd/kfusd.ko /lib/modules/$(KERNELVERSION)/kernel/misc |
|
| @chmod u+x /lib/modules/$(KERNELVERSION)/kernel/misc/kfusd.ko |
|
| else |
|
| cp -f $(OBJDIR)/fusd/kfusd.o /lib/modules/$(KERNELVERSION)/kernel/misc |
|
| @chmod u+x /lib/modules/$(KERNELVERSION)/kernel/misc/kfusd.o |
|
| endif |
|
| @echo "Resolving dependencies... " |
|
| @/sbin/depmod -a |
|
| @echo "Installing fusdd in /usr/sbin..." |
|
| @cp -f $(OBJDIR)/fusd/fusdd /usr/sbin |
|
| # @echo "Loading kfusd... running fusdd " |
|
| # @/usr/sbin/fusdd |
|
| @echo "Now as root, just run /usr/sbin/fusdd" |
|
| |
|
| config.make: |
|
| @echo "Building config.make" |
|
| perl make/htosh.pl $(PWD) |
|