|
|
Jump to this file's LXR Page |
|
|
File: [CENS] / emstar / Makefile.main
(download)
Revision: 1.6, Mon Feb 20 19:06:18 2006 UTC (3 years, 9 months ago) by girod Branch: MAIN CVS Tags: pregeonet, acoustic-05-18-06, PRE_TOSNIC_FIX, PRE_64BIT, HEAD, ESS_CENTROUTE_TESTING, CYCLOPS_RELEASE_CANDIDATE_2_0, CYCLOPS_PRERELEASE_STABLE, CENTROUTE_EMSTAR_SOCKETS, BG_1_0, AMARSS_JR_DEPLOYMENT_6_05_07 Changes since 1.5: +2 -1 lines fixed error in new makefile... was stripping automatically |
#
# CENS EmStar Repository Master Makefile, part 2
#
# $Id: Makefile.main,v 1.6 2006/02/20 19:06:18 girod 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
## If this is the native arch, include config.make
ifeq ($(strip $(ARCH)),i686-linux)
include config.make
else
ifeq ($(ARCH),)
include config.make
endif
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
include make/make.tinyos
# 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)\"
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 EMSTAR_MOTE_FREQ
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
##
## If TinyOS not present, download it
##
# Include that causes tinyos to download
ifeq ($(strip $(BUILD_EMTOS)),1)
DOWNLOAD_TINYOS := tinyos-1.x/.force
else
DOWNLOAD_TINYOS :=
endif
# the default target
.DEFAULT default: $(DOWNLOAD_TINYOS) $(RULES) default-targets $(FUSD_26)
# strip target: strips all binaries other than kernel modules
strip: default-targets
@echo Stripping all binaries...
@$(BINSTRIP) $(ALL_STRIP_TARGETS)
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)
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"
| CENS CVS Mailing List |
Powered by ViewCVS 0.9.2 |