|
|
Jump to this file's LXR Page |
|
|
File: [CENS] / emstar / Makefile
(download)
Revision: 1.55, Thu Oct 27 00:28:14 2005 UTC (4 years ago) by thanos Branch: MAIN Changes since 1.54: +8 -2 lines Added emtos gcc 4 support |
#
# CENS EmStar Repository Master Makefile
#
# $Id: Makefile,v 1.55 2005/10/27 01:28:14 thanos Exp $
#
################### NOTE!!!! ###########################
## Most of the time you want to edit the files called ##
## 'BUILD' and Make.conf, NOT this Makefile. ##
########################################################
## Sets user-modifiable variables
## e.g. enable TOS, Kernel, native kernel headers, etc
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 ($(strip $(USE_DEVFS)),1)
DEVFS_KCFLAG := -DUSE_DEVFS
else
DEVFS_KCFLAG :=
endif
#########################################################
#########################################################
# Set platform-dependent variables. Including this fragment sets:
# ARCH -- the target architecture (e.g., arm-linux or i686-linux)
# NATIVE_ARCH -- the architecture we're compiling under
# CC, CPP, AR, LD, BINSTRIP -- paths to various utils
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)
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)\"
# add no-pointer-sign if we have gcc >=4
ifdef HAVE_GCC_4
CFLAGS += -Wno-pointer-sign -D__HAVE_GCC_4
endif
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
# export this if we have gcc_4 so we can include the right thing
# on the emtos build
ifdef HAVE_GCC_4
export HAVE_GCC_4
endif
# 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
.DEFAULT default: $(RULES) default-targets $(FUSD_26)
# clean target: delete all generated files
clean:
rm -rf ./$(OBJDIR)/$(BUILDDIR)
rm -f $(ALL_TARGETS) $(RULES)
rm -f config.make
# strip target: strips all binaries other than kernel modules
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.
## This target provides info about what vars are set and
## what platforms are available
##
# For debugging purposes, a rule that shows the environment
# and active variables..
help:
@echo Help:
@echo " make ARCH=<platform> [executable path]"
@echo
@echo " EmStar supports the following platforms:"
@echo
@echo " i686-linux (default) is the 'native' platform"
@echo " used to buld to run on your host. Check Make.conf"
@echo " to locally customize the native platform."
@echo
@echo " arm-linux builds for iPAQ"
@echo " ipaq-sa builds for all StrongARM-based iPAQs (Familiar)"
@echo " stargate builds for Stargate release 7"
@echo " stargate-ucla builds for Stargate UCLA release 5"
@echo " pasta builds for PASTA"
@echo " ilense-104 builds for the ilense testbed"
@echo
@echo " mica, mica2, mica2dot, cricket, micaz, telos build Mote targets"
@echo
@echo Environment:
@echo " NATIVE_KCFLAGS=$(NATIVE_KCFLAGS)"
@echo " PKG_CONFIG_PATH=$(PKG_CONFIG_PATH)"
@echo " GLIB_PATH=$(GLIB_PATH)"
@echo " USE_SHARED='$(USE_SHARED)'"
@echo " USE_DEVFS='$(USE_DEVFS)'"
@echo " BUILD_EMTOS='$(BUILD_EMTOS)'"
@echo " TOSDIR=$(TOSDIR)"
@echo " TOS_CONTRIB=$(TOS_CONTRIB)"
@echo " MAKERULES=$(MAKERULES)"
@echo " NESC_DIR=$(NESC_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)
| CENS CVS Mailing List |
Powered by ViewCVS 0.9.2 |