1 #
2 # CENS EmStar Repository Master Makefile
3 #
4 # $Id: Debug-Makefile,v 1.2 2004-11-17 00:32:30 jelson 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 ##
17 ## If you are using shared libraries, you can turn off the following
18 ## flag to cause EmStar to use relative paths to discover its shared
19 ## libs. This is not generally recommended -- using LD_LIBRARY_PATH
20 ## is a better idea.
21 ##
22 REQUIRE_LD_LIBRARY_PATH := 1
23
24 ########################################################
25 ##
26 ## Set various TinyOS related environment variables.
27 ##
28 ## *** WARNING: Changing the settings below is not
29 ## recommended because it does not generally work!
30 ## Use symlinks instead!!
31 ##
32 ## Please see <http://cvs.cens.ucla.edu/emstar/install.html>
33 ## for more detailed information.
34 ##
35 ## NOTE: If you want to configure EmStar to use other
36 ## locations for tinyos or tos-contrib, simply move
37 ## away the bundled versions and add symlinks to
38 ## the locations of the versions you want to use.
39 ##
40 ## We recommend this approach because using environment
41 ## variables is more fragile and harder to track with
42 ## revision control.
43 ##
44 ## The BUILD rules in EmStar are all coded to be relative
45 ## to the EmStar tree, and assume that tinyos and tos-contrib
46 ## are linked from inside it, or are present there.
47 ## Lots of things will break horribly if this is not the
48 ## case.
49 ##
50 ########################################################
51
52 ## TOSDIR points to the SourceForge TinyOS repo.
53 ## This setting points to the version bundled with EmStar
54 TOSDIR := $(PWD)/tinyos-1.x/tos
55
56 ## TOS_CONTRIB points to the CENS tos-contrib repo
57 ## This setting points to the version checked out with EmStar
58 TOS_CONTRIB := $(PWD)/tos-contrib/
59
60 ## MAKERULES controls aspects of the TOS build system
61 ## This setting should be compatible with your TOSDIR setting
62 MAKERULES := $(TOSDIR)/../tools/make/Makerules
63
64 #########################################################
65 #########################################################
66
67 # enable/disable DevFS
68 ifeq ($(USE_DEVFS),1)
69 DEVFS_KCFLAG := -DUSE_DEVFS
70 else
71 DEVFS_KCFLAG :=
72 endif
73
74 #########################################################
75 #########################################################
76
77 # Set platform-dependent variables. Including this fragment sets:
78 # ARCH -- the target architecture (e.g., arm-linux or i686-linux)
79 # NATIVE_ARCH -- the architecture we're compiling under
80 # CC, CPP, AR, LD, BINSTRIP -- paths to various utils
81 include make/make.platform
82
83 # If shared libraries are in use, config the suffix to .so
84 ifeq ($(USE_SHARED),1)
85 LIB_SUFFIX := .so
86 ifeq ($(REQUIRE_LD_LIBRARY_PATH),0)
87 SHARED_LIB_PREFIX := lib/
88 endif
89 else
90 LIB_SUFFIX := .a
91 endif
92
93 # phread a dependency of glib (though we don't generally use it)
94 LDFLAGS += -lm -lpthread $(GLIB_PATH)
95
96 # names of various target directories
97 OBJDIR := obj.$(ARCH)
98 NATIVE_OBJDIR := obj.$(NATIVE_ARCH)
99 BUILDDIR := .build
100 INCDIR := include
101
102 # figure out if a cvs tag has been used here
103 CVSTAG := $(shell make/get-cvs-tag.pl)
104
105 # default compiler and linker flags used by everything
106 # NOTE: some platform-specific flags might be set in make.platform
107 CFLAGS += -Wall -Werror -g -I. -Iglib/include -I$(INCDIR) -DCVSTAG=\"$(CVSTAG)\"
108 KCFLAGS += -DCVSTAG=\"$(CVSTAG)\"
109 CXXFLAGS += -Wall -Werror -g -I. -Iglib/include -I$(INCDIR) -DCVSTAG=\"$(CVSTAG)\"
110
111 # path to find the automatically generated rules
112 RULES := $(OBJDIR)/$(BUILDDIR)/easybuild.rules
113
114 # export some variables to be picked up by sub-makes
115 export PKG_CONFIG_PATH
116 export USE_SHARED
117
118 # export some variables needed for TOS integration
119 export EMSTAR_MAKE=1
120 export EMSTAR_ROOT = $(PWD)
121 export TOSDIR
122 export TOS_CONTRIB
123 export MAKERULES
124 PATH += :$(NESC_DIR)/bin:$(AVR_DIR)/bin
125 export PATH
126 export EMTOS_MAKE_OBJDIR = $(OBJDIR)
127 export EMTOS_MAKE_CC = $(CC)
128 export EMTOS_MAKE_GCCINCLUDE
129 # set up the default location for the cross-compiled glib library
130 ifndef EMTOS_MAKE_LDFLAGS
131 EMTOS_MAKE_LDFLAGS = $(PWD)/$(GLIB_PATH)
132 endif
133 EMTOS_MAKE_LDFLAGS += -lpthread
134 export EMTOS_MAKE_LDFLAGS
135
136 # the default target
137 .DEFAULT default: $(RULES) default-targets
138
139 # clean target: delete all generated files
140 clean:
141 rm -rf ./$(OBJDIR)/$(BUILDDIR)
142 rm -f $(ALL_TARGETS) $(RULES)
143
144 # strip target: strips all binaries other than kernel modules
145 strip: default-targets
146 @echo Stripping all binaries...
147 @$(BINSTRIP) $(ALL_STRIP_TARGETS)
148
149 # Include rules to build the "easybuild" system itself
150 include make/make.easybuild
151
152 # Include the rules automatically generated by easybuild
153 #include $(RULES)
154 default-targets: $(OBJDIR)/make/easybuild
155
156 # And, finally, a rule to invoke easybuild. The rules should be
157 # regenerated if any of three things change: 1) the root BUILD file in
158 # this directory; 2) any of the BUILD files that are recursively read
159 # by easybuild (this list is in the BUILD_LIST variable, which is set
160 # by easybuild and written in .easybuild.rules); or, 3) the easybuild
161 # program itself.
162 $(RULES): BUILD $(BUILD_LIST) $(NATIVE_OBJDIR)/make/easybuild
163 @mkdir -p $(OBJDIR)/$(BUILDDIR)
164 $(NATIVE_OBJDIR)/make/easybuild > $@ || (rm -f $@; exit 1)
165
166 ##
167 ## The 'help' target.
168 ## This target provides info about what vars are set and
169 ## what platforms are available
170 ##
171
172 # For debugging purposes, a rule that shows the environment
173 # and active variables..
174 help:
175 @echo Help:
176 @echo " make ARCH=<platform> [executable path]"
177 @echo
178 @echo " EmStar supports the following platforms:"
179 @echo
180 @echo " i686-linux (default) is the 'native' platform"
181 @echo " used to buld to run on your host. Check Make.conf"
182 @echo " to locally customize the native platform."
183 @echo
184 @echo " arm-linux builds for iPAQ"
185 @echo " ipaq-sa builds for all StrongARM-based iPAQs (Familiar)"
186 @echo " stargate builds for Stargate release 7"
187 @echo " stargate-ucla builds for Stargate UCLA release 5"
188 @echo " pasta builds for PASTA"
189 @echo " ilense-104 builds for the ilense testbed"
190 @echo
191 @echo " mica, mica2, mica2dot, cricket build Mote targets"
192 @echo
193 @echo Environment:
194 @echo " NATIVE_KCFLAGS=$(NATIVE_KCFLAGS)"
195 @echo " PKG_CONFIG_PATH=$(PKG_CONFIG_PATH)"
196 @echo " GLIB_PATH=$(GLIB_PATH)"
197 @echo " USE_SHARED='$(USE_SHARED)'"
198 @echo " USE_DEVFS='$(USE_DEVFS)'"
199 @echo " BUILD_EMTOS='$(BUILD_EMTOS)'"
200 @echo " TOSDIR=$(TOSDIR)"
201 @echo " TOS_CONTRIB=$(TOS_CONTRIB)"
202 @echo " MAKERULES=$(MAKERULES)"
203 @echo " NESC_DIR=$(NESC_DIR)"
204 @echo " AVR_DIR=$(AVR_DIR)"
205
206 KERNELVERSION := $(shell uname -r)
207
208 # experimental... must be done as root should we use easybuild to do this?
209 install-fusd: default
210 @echo "Copying module kfusd.o... "
211 mkdir -p /lib/modules/$(KERNELVERSION)/kernel/misc
212 cp -f $(OBJDIR)/fusd/kfusd.o /lib/modules/$(KERNELVERSION)/kernel/misc
213 @chmod u+x /lib/modules/$(KERNELVERSION)/kernel/misc/kfusd.o
214 @echo "Resolving dependencies... "
215 @/sbin/depmod -a
216 @echo "Loading kfusd.o... "
217 @/sbin/insmod kfusd
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.