(file) Return to Makefile CVS log (file) Jump to this file's LXR Page (dir) Up to [CENS] / emstar

  1 jelson 1.1 #
  2 jelson 1.17 # CENS EmStar Repository Master Makefile
  3 jelson 1.1  #
  4 girod  1.52 # $Id: Makefile,v 1.51 2005/09/16 04:53:45 girod Exp $
  5 jelson 1.1  #
  6             
  7 jelson 1.2  ################### NOTE!!!! ###########################
  8             ## Most of the time you want to edit the files called ##
  9 girod  1.18 ## 'BUILD' and Make.conf, NOT this Makefile.          ##
 10 jelson 1.2  ########################################################
 11             
 12 girod  1.20 ## Sets user-modifiable variables
 13             ## e.g. enable TOS, Kernel, native kernel headers, etc
 14 girod  1.18 include Make.conf
 15             
 16 girod  1.40 ##  USE_DEVFS.  This flag causes the FUSD kernel module to build with
 17             ##  devfs support.  DevFS seems to have race conditions and we do not
 18             ##  recommend using it
 19             USE_DEVFS := 0
 20             
 21 girod  1.29 ##
 22             ##  If you are using shared libraries, you can turn off the following
 23             ##  flag to cause EmStar to use relative paths to discover its shared
 24             ##  libs.  This is not generally recommended -- using LD_LIBRARY_PATH
 25             ##  is a better idea.
 26             ##
 27             REQUIRE_LD_LIBRARY_PATH := 1
 28             
 29             ########################################################
 30             ##
 31             ##  Set various TinyOS related environment variables.
 32             ##
 33             ##  *** WARNING: Changing the settings below is not 
 34 girod  1.33 ##  recommended because it does not generally work!  
 35             ##  Use symlinks instead!!
 36 girod  1.29 ##
 37             ##  Please see <http://cvs.cens.ucla.edu/emstar/install.html>
 38             ##  for more detailed information.
 39             ##
 40             ##  NOTE: If you want to configure EmStar to use other
 41             ##  locations for tinyos or tos-contrib, simply move 
 42             ##  away the bundled versions and add symlinks to 
 43             ##  the locations of the versions you want to use.  
 44             ##
 45             ##  We recommend this approach because using environment
 46             ##  variables is more fragile and harder to track with 
 47             ##  revision control.  
 48             ##
 49 girod  1.33 ##  The BUILD rules in EmStar are all coded to be relative
 50             ##  to the EmStar tree, and assume that tinyos and tos-contrib 
 51             ##  are linked from inside it, or are present there.
 52             ##  Lots of things will break horribly if this is not the
 53             ##  case.
 54 girod  1.29 ##
 55             ########################################################
 56             
 57             ##  TOSDIR points to the SourceForge TinyOS repo.
 58             ##  This setting points to the version bundled with EmStar
 59 eugene 1.32 TOSDIR := $(PWD)/tinyos-1.x/tos
 60 girod  1.29 
 61             ##  TOS_CONTRIB points to the CENS tos-contrib repo
 62             ##  This setting points to the version checked out with EmStar
 63             TOS_CONTRIB := $(PWD)/tos-contrib/
 64             
 65             ##  MAKERULES controls aspects of the TOS build system
 66             ##  This setting should be compatible with your TOSDIR setting
 67             MAKERULES := $(TOSDIR)/../tools/make/Makerules
 68             
 69             #########################################################
 70             #########################################################
 71             
 72             # enable/disable DevFS
 73 girod  1.52 ifeq ($(strip $(USE_DEVFS)),1)
 74 girod  1.29   DEVFS_KCFLAG := -DUSE_DEVFS
 75             else
 76               DEVFS_KCFLAG := 
 77             endif
 78             
 79             #########################################################
 80             #########################################################
 81             
 82 jelson 1.7  # Set platform-dependent variables.  Including this fragment sets:
 83             #  ARCH -- the target architecture (e.g., arm-linux or i686-linux)
 84             #  NATIVE_ARCH -- the architecture we're compiling under
 85             #  CC, CPP, AR, LD, BINSTRIP -- paths to various utils
 86             include make/make.platform
 87             
 88 girod  1.26 # If shared libraries are in use, config the suffix to .so
 89 girod  1.52 ifeq ($(strip $(USE_SHARED)),1)
 90 girod  1.26   LIB_SUFFIX := .so
 91 girod  1.52   ifeq ($(strip $(REQUIRE_LD_LIBRARY_PATH)),0)
 92 girod  1.26     SHARED_LIB_PREFIX := lib/
 93               endif
 94             else
 95               LIB_SUFFIX := .a
 96             endif
 97 girod  1.27 
 98             # phread a dependency of glib (though we don't generally use it)
 99 girod  1.28 LDFLAGS += -lm -lpthread $(GLIB_PATH)
100 girod  1.26 
101 jelson 1.7  # names of various target directories
102 jelson 1.1  OBJDIR := obj.$(ARCH)
103             NATIVE_OBJDIR := obj.$(NATIVE_ARCH)
104 jelson 1.2  BUILDDIR := .build
105 jelson 1.5  INCDIR := include
106             
107 jelson 1.8  # figure out if a cvs tag has been used here
108             CVSTAG :=  $(shell make/get-cvs-tag.pl)
109             
110 jelson 1.9  # default compiler and linker flags used by everything
111             # NOTE: some platform-specific flags might be set in make.platform
112 jelson 1.36 ifndef NO_PIC
113                CFLAGS += -fPIC
114                CXXFLAGS += -fPIC
115             endif
116             
117 girod  1.52 # Set up cflags for stuff that's going in a library and stuff
118             # that's going in an executable...
119             ifeq ($(strip $(DEBUG_LIBS)),1)
120               CFLAGS_LIBS += -g
121             endif
122             ifeq ($(strip $(DEBUG_EXES)),1)
123               CFLAGS_EXES += -g
124             endif
125             
126             CFLAGS  += -Wall -Werror -I. $(GLIB_CFLAGS) -I$(INCDIR) -DCVSTAG=\"$(CVSTAG)\"
127 jelson 1.16 KCFLAGS += -DCVSTAG=\"$(CVSTAG)\"
128 girod  1.52 CXXFLAGS += -Wall -Werror -I. $(GLIB_CFLAGS) -I$(INCDIR) -DCVSTAG=\"$(CVSTAG)\"
129 jelson 1.5  
130 jelson 1.17 # path to find the automatically generated rules
131             RULES := $(OBJDIR)/$(BUILDDIR)/easybuild.rules
132 jelson 1.1  
133 girod  1.26 # export some variables to be picked up by sub-makes
134 girod  1.18 export PKG_CONFIG_PATH
135 girod  1.26 export USE_SHARED
136             
137             # export some variables needed for TOS integration
138             export EMSTAR_MAKE=1
139             export EMSTAR_ROOT = $(PWD)
140 girod  1.18 export TOSDIR
141             export TOS_CONTRIB
142             export MAKERULES
143             PATH += :$(NESC_DIR)/bin:$(AVR_DIR)/bin
144             export PATH
145 girod  1.26 export EMTOS_MAKE_OBJDIR = $(OBJDIR)
146             export EMTOS_MAKE_CC = $(CC)
147             export EMTOS_MAKE_GCCINCLUDE
148 girod  1.41 export GLIB_CFLAGS
149 girod  1.24 # set up the default location for the cross-compiled glib library
150 girod  1.26 ifndef EMTOS_MAKE_LDFLAGS
151               EMTOS_MAKE_LDFLAGS = $(PWD)/$(GLIB_PATH)
152 girod  1.24 endif
153 girod  1.28 EMTOS_MAKE_LDFLAGS += -lpthread
154 girod  1.26 export EMTOS_MAKE_LDFLAGS
155 girod  1.18 
156 mlukac 1.43 # setup stuff for 2.6 on kfusd
157             ifeq ($(strip $(BUILD_KMODULES)),1)
158             	ifeq ($(strip $(BUILD_KMODULES_26)),1)
159             		FUSD_26 := $(OBJDIR)/fusd/kfusd.ko
160             	endif
161             endif
162             
163 jelson 1.12 # the default target
164 mlukac 1.43 .DEFAULT default: $(RULES) default-targets $(FUSD_26)
165 jelson 1.12 
166 jelson 1.15 # clean target: delete all generated files
167 jelson 1.12 clean:
168             	rm -rf ./$(OBJDIR)/$(BUILDDIR)
169             	rm -f $(ALL_TARGETS) $(RULES)
170 jelson 1.15 
171             # strip target: strips all binaries other than kernel modules
172             strip: default-targets
173             	@echo Stripping all binaries...
174             	@$(BINSTRIP) $(ALL_STRIP_TARGETS)
175 jelson 1.12 
176 girod  1.50 ##
177             ##  If TinyOS not present, download it
178             ##
179             
180 girod  1.49 # Include that causes tinyos to download
181             include tinyos-1.x/.force
182             
183 girod  1.50 tinyos-1.x/.force: 
184 girod  1.51 	@if [[ -d tinyos-1.x ]]; then \
185             	echo **** Using TinyOS installation that is already there... ; \
186             	else \
187             	echo TinyOS installation not found! ; \
188             	echo Downloading and installing TinyOS-1.x from EmStar website... ; \
189             	wget http://cvs.cens.ucla.edu/emstar-platforms/tinyos-1.1.13-linked.tgz -O - | tar -xzf - ; \
190             	fi
191 girod  1.50 	touch tinyos-1.x/.force
192             
193 jelson 1.1  # Include rules to build the "easybuild" system itself
194 jelson 1.6  include make/make.easybuild
195 jelson 1.1  
196 jelson 1.7  # Include the rules automatically generated by easybuild
197 jelson 1.12 include $(RULES)
198 jelson 1.1  
199 jelson 1.3  # And, finally, a rule to invoke easybuild.  The rules should be
200             # regenerated if any of three things change: 1) the root BUILD file in
201             # this directory; 2) any of the BUILD files that are recursively read
202             # by easybuild (this list is in the BUILD_LIST variable, which is set
203             # by easybuild and written in .easybuild.rules); or, 3) the easybuild
204             # program itself.
205 jelson 1.12 $(RULES): BUILD $(BUILD_LIST) $(NATIVE_OBJDIR)/make/easybuild
206             	@mkdir -p $(OBJDIR)/$(BUILDDIR)
207 girod  1.25 	$(NATIVE_OBJDIR)/make/easybuild > $@ || (rm -f $@; exit 1)
208 girod  1.18 
209             ##
210             ##  The 'help' target.
211             ##  This target provides info about what vars are set and
212             ##  what platforms are available
213             ##
214             
215             # For debugging purposes, a rule that shows the environment
216             # and active variables..
217             help:
218             	@echo Help:
219             	@echo " make ARCH=<platform> [executable path]"
220             	@echo 
221             	@echo " EmStar supports the following platforms:"
222             	@echo 
223             	@echo "  i686-linux (default) is the 'native' platform"
224             	@echo "    used to buld to run on your host.  Check Make.conf"
225             	@echo "    to locally customize the native platform."
226             	@echo 
227             	@echo "  arm-linux builds for iPAQ"
228 eugene 1.31 	@echo "  ipaq-sa builds for all StrongARM-based iPAQs (Familiar)"
229 girod  1.26 	@echo "  stargate builds for Stargate release 7"
230             	@echo "  stargate-ucla builds for Stargate UCLA release 5"
231 girod  1.18 	@echo "  pasta builds for PASTA"
232 girod  1.34 	@echo "  ilense-104 builds for the ilense testbed"
233 girod  1.18 	@echo 
234 girod  1.42 	@echo "  mica, mica2, mica2dot, cricket, micaz, telos build Mote targets"
235 girod  1.18 	@echo 
236             	@echo Environment:
237             	@echo " NATIVE_KCFLAGS=$(NATIVE_KCFLAGS)"
238 girod  1.29 	@echo " PKG_CONFIG_PATH=$(PKG_CONFIG_PATH)"
239             	@echo " GLIB_PATH=$(GLIB_PATH)"
240 girod  1.26 	@echo " USE_SHARED='$(USE_SHARED)'"
241 girod  1.29 	@echo " USE_DEVFS='$(USE_DEVFS)'"
242 girod  1.26 	@echo " BUILD_EMTOS='$(BUILD_EMTOS)'"
243 girod  1.21 	@echo " TOSDIR=$(TOSDIR)"
244             	@echo " TOS_CONTRIB=$(TOS_CONTRIB)"
245             	@echo " MAKERULES=$(MAKERULES)"
246 girod  1.18 	@echo " NESC_DIR=$(NESC_DIR)"
247             	@echo " AVR_DIR=$(AVR_DIR)"
248             
249 eugene 1.32 KERNELVERSION := $(shell uname -r)
250 mlukac 1.44 KVERS_MAJOR := $(shell uname -r | cut -d . -f 2)
251             # Installs kfusd and fusdd. Must be done as root!
252 eugene 1.32 install-fusd: default
253 mlukac 1.44 	@echo "You must be root for this to work!!!"
254             	@echo "Copying module kfusd... "
255 eugene 1.32 	mkdir -p /lib/modules/$(KERNELVERSION)/kernel/misc
256 mlukac 1.44 ifeq ($(strip $(KVERS_MAJOR)),6)
257 mlukac 1.45 	cp -f $(OBJDIR)/fusd/kfusd.ko /lib/modules/$(KERNELVERSION)/kernel/misc
258 mlukac 1.44 	@chmod u+x /lib/modules/$(KERNELVERSION)/kernel/misc/kfusd.ko
259             else
260 mlukac 1.45 	cp -f $(OBJDIR)/fusd/kfusd.o /lib/modules/$(KERNELVERSION)/kernel/misc
261 eugene 1.32 	@chmod u+x /lib/modules/$(KERNELVERSION)/kernel/misc/kfusd.o
262 mlukac 1.44 endif
263 eugene 1.32 	@echo "Resolving dependencies... "
264             	@/sbin/depmod -a
265 girod  1.40 	@echo "Installing fusdd in /usr/sbin..."
266             	@cp -f $(OBJDIR)/fusd/fusdd /usr/sbin
267 mlukac 1.45 #	@echo "Loading kfusd... running fusdd "
268             #	@/usr/sbin/fusdd
269             	@echo "Now as root, just run /usr/sbin/fusdd"
270 girod  1.37 

CENS CVS Mailing List
Powered by
ViewCVS 0.9.2