~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
cvs/emstar/Makefile.main


  1 #
  2 # CENS EmStar Repository Master Makefile, part 2
  3 #
  4 # $Id: Makefile.main,v 1.6 2006-02-20 19:06:18 girod Exp $
  5 #
  6 
  7 ################### NOTE!!!! ###########################
  8 ## Most of the time you want to edit the files called ##
  9 ## 'BUILD' and Make.conf, NOT this Makefile.          ##
 10 ########################################################
 11 
 12 ## Sets user-modifiable variables
 13 ## e.g. enable TOS, Kernel, native kernel headers, etc
 14 include Make.conf
 15 
 16 ## If this is the native arch, include config.make
 17 ifeq ($(strip $(ARCH)),i686-linux)
 18 include config.make
 19 else
 20   ifeq ($(ARCH),)
 21   include config.make
 22   endif
 23 endif
 24 
 25 ##  USE_DEVFS.  This flag causes the FUSD kernel module to build with
 26 ##  devfs support.  DevFS seems to have race conditions and we do not
 27 ##  recommend using it
 28 USE_DEVFS := 0
 29 
 30 ##
 31 ##  If you are using shared libraries, you can turn off the following
 32 ##  flag to cause EmStar to use relative paths to discover its shared
 33 ##  libs.  This is not generally recommended -- using LD_LIBRARY_PATH
 34 ##  is a better idea.
 35 ##
 36 REQUIRE_LD_LIBRARY_PATH := 1
 37 
 38 include make/make.tinyos
 39 
 40 # enable/disable DevFS
 41 ifeq ($(strip $(USE_DEVFS)),1)
 42   DEVFS_KCFLAG := -DUSE_DEVFS
 43 else
 44   DEVFS_KCFLAG := 
 45 endif
 46 
 47 #########################################################
 48 #########################################################
 49 
 50 # Set platform-dependent variables.  Including this fragment sets:
 51 #  ARCH -- the target architecture (e.g., arm-linux or i686-linux)
 52 #  NATIVE_ARCH -- the architecture we're compiling under
 53 #  CC, CPP, AR, LD, BINSTRIP -- paths to various utils
 54 include make/make.platform
 55 
 56 # If shared libraries are in use, config the suffix to .so
 57 ifeq ($(strip $(USE_SHARED)),1)
 58   LIB_SUFFIX := .so
 59   ifeq ($(strip $(REQUIRE_LD_LIBRARY_PATH)),0)
 60     SHARED_LIB_PREFIX := lib/
 61   endif
 62 else
 63   LIB_SUFFIX := .a
 64 endif
 65 
 66 # phread a dependency of glib (though we don't generally use it)
 67 LDFLAGS += -lm -lpthread $(GLIB_PATH)
 68 
 69 # names of various target directories
 70 OBJDIR := obj.$(ARCH)
 71 NATIVE_OBJDIR := obj.$(NATIVE_ARCH)
 72 BUILDDIR := .build
 73 INCDIR := include
 74 
 75 # figure out if a cvs tag has been used here
 76 CVSTAG :=  $(shell make/get-cvs-tag.pl)
 77 
 78 # default compiler and linker flags used by everything
 79 # NOTE: some platform-specific flags might be set in make.platform
 80 ifndef NO_PIC
 81    CFLAGS += -fPIC
 82    CXXFLAGS += -fPIC
 83 endif
 84 
 85 # Set up cflags for stuff that's going in a library and stuff
 86 # that's going in an executable...
 87 ifeq ($(strip $(DEBUG_LIBS)),1)
 88   CFLAGS_LIBS += -g
 89 endif
 90 ifeq ($(strip $(DEBUG_EXES)),1)
 91   CFLAGS_EXES += -g
 92 endif
 93 
 94 CFLAGS  += -Wall -Werror -I. $(GLIB_CFLAGS) -I$(INCDIR) -DCVSTAG=\"$(CVSTAG)\"
 95 KCFLAGS += -DCVSTAG=\"$(CVSTAG)\"
 96 CXXFLAGS += -Wall -Werror -I. $(GLIB_CFLAGS) -I$(INCDIR) -DCVSTAG=\"$(CVSTAG)\"
 97 
 98 # path to find the automatically generated rules
 99 RULES := $(OBJDIR)/$(BUILDDIR)/easybuild.rules
100 
101 # export some variables to be picked up by sub-makes
102 export PKG_CONFIG_PATH
103 export USE_SHARED
104 
105 # export some variables needed for TOS integration
106 export EMSTAR_MAKE=1
107 export EMSTAR_ROOT = $(PWD)
108 export EMSTAR_MOTE_FREQ
109 export TOSDIR
110 export TOS_CONTRIB
111 export MAKERULES
112 PATH += :$(NESC_DIR)/bin:$(AVR_DIR)/bin
113 export PATH
114 export EMTOS_MAKE_OBJDIR = $(OBJDIR)
115 export EMTOS_MAKE_CC = $(CC)
116 export EMTOS_MAKE_GCCINCLUDE
117 export GLIB_CFLAGS
118 # set up the default location for the cross-compiled glib library
119 ifndef EMTOS_MAKE_LDFLAGS
120   EMTOS_MAKE_LDFLAGS = $(PWD)/$(GLIB_PATH)
121 endif
122 EMTOS_MAKE_LDFLAGS += -lpthread
123 export EMTOS_MAKE_LDFLAGS
124 
125 # setup stuff for 2.6 on kfusd
126 ifeq ($(strip $(BUILD_KMODULES)),1)
127         ifeq ($(strip $(BUILD_KMODULES_26)),1)
128                 FUSD_26 := $(OBJDIR)/fusd/kfusd.ko
129         endif
130 endif
131 
132 
133 ##
134 ##  If TinyOS not present, download it
135 ##
136 
137 # Include that causes tinyos to download
138 ifeq ($(strip $(BUILD_EMTOS)),1)
139         DOWNLOAD_TINYOS := tinyos-1.x/.force
140 else
141         DOWNLOAD_TINYOS :=
142 endif
143 
144 
145 # the default target
146 .DEFAULT default: $(DOWNLOAD_TINYOS) $(RULES) default-targets $(FUSD_26)
147 
148 
149 # strip target: strips all binaries other than kernel modules
150 strip: default-targets
151         @echo Stripping all binaries...
152         @$(BINSTRIP) $(ALL_STRIP_TARGETS)
153 
154 
155 tinyos-1.x/.force: 
156         @if [[ -d tinyos-1.x ]]; then \
157         echo **** Using TinyOS installation that is already there... ; \
158         else \
159         echo TinyOS installation not found! ; \
160         echo Downloading and installing TinyOS-1.x from EmStar website... ; \
161         wget http://cvs.cens.ucla.edu/emstar-platforms/tinyos-1.1.13-linked.tgz -O - | tar -xzf - ; \
162         fi
163         touch tinyos-1.x/.force
164 
165 # Include rules to build the "easybuild" system itself
166 include make/make.easybuild
167 
168 # Include the rules automatically generated by easybuild
169 include $(RULES)
170 
171 # And, finally, a rule to invoke easybuild.  The rules should be
172 # regenerated if any of three things change: 1) the root BUILD file in
173 # this directory; 2) any of the BUILD files that are recursively read
174 # by easybuild (this list is in the BUILD_LIST variable, which is set
175 # by easybuild and written in .easybuild.rules); or, 3) the easybuild
176 # program itself.
177 $(RULES): BUILD $(BUILD_LIST) $(NATIVE_OBJDIR)/make/easybuild
178         @mkdir -p $(OBJDIR)/$(BUILDDIR)
179         $(NATIVE_OBJDIR)/make/easybuild > $@ || (rm -f $@; exit 1)
180 
181 
182 KERNELVERSION := $(shell uname -r)
183 KVERS_MAJOR := $(shell uname -r | cut -d . -f 2)
184 # Installs kfusd and fusdd. Must be done as root!
185 install-fusd: default
186         @echo "You must be root for this to work!!!"
187         @echo "Copying module kfusd... "
188         mkdir -p /lib/modules/$(KERNELVERSION)/kernel/misc
189 ifeq ($(strip $(KVERS_MAJOR)),6)
190         cp -f $(OBJDIR)/fusd/kfusd.ko /lib/modules/$(KERNELVERSION)/kernel/misc
191         @chmod u+x /lib/modules/$(KERNELVERSION)/kernel/misc/kfusd.ko
192 else
193         cp -f $(OBJDIR)/fusd/kfusd.o /lib/modules/$(KERNELVERSION)/kernel/misc
194         @chmod u+x /lib/modules/$(KERNELVERSION)/kernel/misc/kfusd.o
195 endif
196         @echo "Resolving dependencies... "
197         @/sbin/depmod -a
198         @echo "Installing fusdd in /usr/sbin..."
199         @cp -f $(OBJDIR)/fusd/fusdd /usr/sbin
200 #       @echo "Loading kfusd... running fusdd "
201 #       @/usr/sbin/fusdd
202         @echo "Now as root, just run /usr/sbin/fusdd"
203 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.