~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to Makefile

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
VERSION = 2
2
 
PATCHLEVEL = 6
3
 
SUBLEVEL = 38
4
 
EXTRAVERSION = .4
5
 
NAME = Flesh-Eating Bats with Fangs
 
1
VERSION = 3
 
2
PATCHLEVEL = 0
 
3
SUBLEVEL = 0
 
4
EXTRAVERSION = -rc7
 
5
NAME = Sneaky Weasel
6
6
 
7
7
# *DOCUMENTATION*
8
8
# To see a list of typical targets execute "make help"
102
102
  KBUILD_OUTPUT := $(O)
103
103
endif
104
104
 
 
105
ifeq ("$(origin W)", "command line")
 
106
  export KBUILD_ENABLE_EXTRA_GCC_CHECKS := $(W)
 
107
endif
 
108
 
105
109
# That's our default target when none is given on the command line
106
110
PHONY := _all
107
111
_all:
216
220
       SRCARCH := sh
217
221
endif
218
222
 
 
223
# Additional ARCH settings for tile
 
224
ifeq ($(ARCH),tilepro)
 
225
       SRCARCH := tile
 
226
endif
 
227
ifeq ($(ARCH),tilegx)
 
228
       SRCARCH := tile
 
229
endif
 
230
 
219
231
# Where to locate arch specific headers
220
232
hdr-arch  := $(SRCARCH)
221
233
 
351
363
 
352
364
# Use LINUXINCLUDE when you must reference the include/ directory.
353
365
# Needed to be compatible with the O= option
354
 
LINUXINCLUDE    := $(UBUNTUINCLUDE) -I$(srctree)/arch/$(hdr-arch)/include -Iinclude \
 
366
LINUXINCLUDE    := $(UBUNTUINCLUDE) -I$(srctree)/arch/$(hdr-arch)/include \
 
367
                   -Iarch/$(hdr-arch)/include/generated -Iinclude \
355
368
                   $(if $(KBUILD_SRC), -I$(srctree)/include) \
356
369
                   -include include/generated/autoconf.h
357
370
 
374
387
 
375
388
# Read KERNELRELEASE from include/config/kernel.release (if it exists)
376
389
KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null)
377
 
KERNELVERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
 
390
KERNELVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION)
378
391
 
379
392
export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION
380
393
export ARCH SRCARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC
387
400
export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
388
401
export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_LDFLAGS_MODULE
389
402
export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL
 
403
export KBUILD_ARFLAGS
390
404
 
391
405
# When compiling out-of-tree modules, put MODVERDIR in the module
392
406
# tree rather than in the kernel tree. The kernel tree might
421
435
            $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL)
422
436
endif
423
437
 
 
438
# Support for using generic headers in asm-generic
 
439
PHONY += asm-generic
 
440
asm-generic:
 
441
        $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.asm-generic \
 
442
                    obj=arch/$(SRCARCH)/include/generated/asm
 
443
 
424
444
# To make sure we do not include .config for any of the *config targets
425
445
# catch them early, and hand them over to scripts/kconfig/Makefile
426
446
# It is allowed to specify more targets when calling make, including
430
450
# of make so .config is not included in this case either (for *config).
431
451
 
432
452
no-dot-config-targets := clean mrproper distclean \
433
 
                         cscope TAGS tags help %docs check% coccicheck \
 
453
                         cscope gtags TAGS tags help %docs check% coccicheck \
434
454
                         include/linux/version.h headers_% \
435
455
                         kernelversion %src-pkg
436
456
 
564
584
KBUILD_CFLAGS += $(call cc-option, -fno-stack-protector)
565
585
endif
566
586
 
 
587
# This warning generated too much noise in a regular build.
 
588
# Use make W=1 to enable this warning (see scripts/Makefile.build)
 
589
KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable)
 
590
 
567
591
ifdef CONFIG_FRAME_POINTER
568
592
KBUILD_CFLAGS   += -fno-omit-frame-pointer -fno-optimize-sibling-calls
569
593
else
609
633
KBUILD_CFLAGS += $(call cc-option,-Wdeclaration-after-statement,)
610
634
 
611
635
# disable pointer signed / unsigned warnings in gcc 4.0
612
 
KBUILD_CFLAGS += $(call cc-option,-Wno-pointer-sign,)
 
636
KBUILD_CFLAGS += $(call cc-disable-warning, pointer-sign)
613
637
 
614
638
# disable invalid "can't wrap" optimizations for signed / pointers
615
639
KBUILD_CFLAGS   += $(call cc-option,-fno-strict-overflow)
617
641
# conserve stack if available
618
642
KBUILD_CFLAGS   += $(call cc-option,-fconserve-stack)
619
643
 
 
644
# use the deterministic mode of AR if available
 
645
KBUILD_ARFLAGS := $(call ar-option,D)
 
646
 
620
647
# check for 'asm goto'
621
648
ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC)), y)
622
649
        KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO
675
702
#  INSTALL_MOD_STRIP, if defined, will cause modules to be
676
703
#  stripped after they are installed.  If INSTALL_MOD_STRIP is '1', then
677
704
#  the default option --strip-debug will be used.  Otherwise,
678
 
#  INSTALL_MOD_STRIP will used as the options to the strip command.
 
705
#  INSTALL_MOD_STRIP value will be used as the options to the strip command.
679
706
 
680
707
ifdef INSTALL_MOD_STRIP
681
708
ifeq ($(INSTALL_MOD_STRIP),1)
802
829
# o The correct .tmp_kallsyms2.o is linked into the final vmlinux.
803
830
# o Verify that the System.map from vmlinux matches the map from
804
831
#   .tmp_vmlinux2, just in case we did not generate kallsyms correctly.
805
 
# o If CONFIG_KALLSYMS_EXTRA_PASS is set, do an extra pass using
 
832
# o If 'make KALLSYMS_EXTRA_PASS=1" was used, do an extra pass using
806
833
#   .tmp_vmlinux3 and .tmp_kallsyms3.o.  This is only meant as a
807
834
#   temporary bypass to allow the kernel to be built while the
808
835
#   maintainers work out what went wrong with kallsyms.
809
836
 
810
 
ifdef CONFIG_KALLSYMS_EXTRA_PASS
 
837
last_kallsyms := 2
 
838
 
 
839
ifdef KALLSYMS_EXTRA_PASS
 
840
ifneq ($(KALLSYMS_EXTRA_PASS),0)
811
841
last_kallsyms := 3
812
 
else
813
 
last_kallsyms := 2
 
842
endif
814
843
endif
815
844
 
816
845
kallsyms.o := .tmp_kallsyms$(last_kallsyms).o
821
850
          $(cmd_sysmap) .tmp_vmlinux$(last_kallsyms) .tmp_System.map
822
851
        $(Q)cmp -s System.map .tmp_System.map ||                             \
823
852
                (echo Inconsistent kallsyms data;                            \
824
 
                 echo Try setting CONFIG_KALLSYMS_EXTRA_PASS;                \
 
853
                 echo This is a bug - please report about it;                \
 
854
                 echo Try "make KALLSYMS_EXTRA_PASS=1" as a workaround;      \
825
855
                 rm .tmp_kallsyms* ; /bin/false )
826
856
endef
827
857
 
952
982
endif
953
983
 
954
984
# prepare2 creates a makefile if using a separate output directory
955
 
prepare2: prepare3 outputmakefile
 
985
prepare2: prepare3 outputmakefile asm-generic
956
986
 
957
987
prepare1: prepare2 include/linux/version.h include/generated/utsrelease.h \
958
988
                   include/config/auto.conf
984
1014
 
985
1015
define filechk_version.h
986
1016
        (echo \#define LINUX_VERSION_CODE $(shell                             \
987
 
        expr $(VERSION) \* 65536 + $(PATCHLEVEL) \* 256 + $(SUBLEVEL));     \
 
1017
        expr $(VERSION) \* 65536 + 0$(PATCHLEVEL) \* 256 + 0$(SUBLEVEL));    \
988
1018
        echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))';)
989
1019
endef
990
1020
 
996
1026
 
997
1027
PHONY += headerdep
998
1028
headerdep:
999
 
        $(Q)find include/ -name '*.h' | xargs --max-args 1 scripts/headerdep.pl
 
1029
        $(Q)find $(srctree)/include/ -name '*.h' | xargs --max-args 1 \
 
1030
        $(srctree)/scripts/headerdep.pl -I$(srctree)/include
1000
1031
 
1001
1032
# ---------------------------------------------------------------------------
1002
1033
 
1026
1057
hdr-dst = $(if $(KBUILD_HEADERS), dst=include/asm-$(hdr-arch), dst=include/asm)
1027
1058
 
1028
1059
PHONY += __headers
1029
 
__headers: include/linux/version.h scripts_basic FORCE
1030
 
        $(Q)$(MAKE) $(build)=scripts scripts/unifdef
 
1060
__headers: include/linux/version.h scripts_basic asm-generic FORCE
 
1061
        $(Q)$(MAKE) $(build)=scripts build_unifdef
1031
1062
 
1032
1063
PHONY += headers_install_all
1033
1064
headers_install_all:
1090
1121
 
1091
1122
PHONY += _modinst_
1092
1123
_modinst_:
1093
 
        @if [ -z "`$(DEPMOD) -V 2>/dev/null | grep module-init-tools`" ]; then \
1094
 
                echo "Warning: you may need to install module-init-tools"; \
1095
 
                echo "See http://www.codemonkey.org.uk/docs/post-halloween-2.6.txt";\
1096
 
                sleep 1; \
1097
 
        fi
1098
1124
        @rm -rf $(MODLIB)/kernel
1099
1125
        @rm -f $(MODLIB)/source
1100
1126
        @mkdir -p $(MODLIB)/kernel
1143
1169
                .tmp_kallsyms* .tmp_version .tmp_vmlinux* .tmp_System.map
1144
1170
 
1145
1171
# Directories & files removed with 'make mrproper'
1146
 
MRPROPER_DIRS  += include/config usr/include include/generated
 
1172
MRPROPER_DIRS  += include/config usr/include include/generated          \
 
1173
                  arch/*/include/generated
1147
1174
MRPROPER_FILES += .config .config.old .version .old_version             \
1148
1175
                  include/linux/version.h                               \
1149
 
                  Module.symvers tags TAGS cscope*
 
1176
                  Module.symvers tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS
1150
1177
 
1151
1178
# clean - Delete most, but leave enough to build external modules
1152
1179
#
1233
1260
        @echo  '  modules_prepare - Set up for building external modules'
1234
1261
        @echo  '  tags/TAGS       - Generate tags file for editors'
1235
1262
        @echo  '  cscope          - Generate cscope index'
 
1263
        @echo  '  gtags           - Generate GNU GLOBAL index'
1236
1264
        @echo  '  kernelrelease   - Output the release version string'
1237
1265
        @echo  '  kernelversion   - Output the version stored in Makefile'
1238
1266
        @echo  '  headers_install - Install sanitised kernel headers to INSTALL_HDR_PATH'; \
1273
1301
        @echo  '  make O=dir [targets] Locate all output files in "dir", including .config'
1274
1302
        @echo  '  make C=1   [targets] Check all c source with $$CHECK (sparse by default)'
1275
1303
        @echo  '  make C=2   [targets] Force check of all c source with $$CHECK'
 
1304
        @echo  '  make W=n   [targets] Enable extra gcc checks, n=1,2,3 where'
 
1305
        @echo  '                1: warnings which may be relevant and do not occur too often'
 
1306
        @echo  '                2: warnings which occur quite often but may still be relevant'
 
1307
        @echo  '                3: more obscure warnings, can most likely be ignored'
 
1308
        @echo  '                Multiple levels can be combined with W=12 or W=123'
 
1309
        @echo  '  make RECORDMCOUNT_WARN=1 [targets] Warn about ignored mcount sections'
1276
1310
        @echo  ''
1277
1311
        @echo  'Execute "make" or "make all" to build all targets marked with [*] '
1278
1312
        @echo  'For further info see the ./README file'
1295
1329
# Documentation targets
1296
1330
# ---------------------------------------------------------------------------
1297
1331
%docs: scripts_basic FORCE
 
1332
        $(Q)$(MAKE) $(build)=scripts build_docproc
1298
1333
        $(Q)$(MAKE) $(build)=Documentation/DocBook $@
1299
1334
 
1300
1335
else # KBUILD_EXTMOD
1379
1414
clean: $(clean-dirs)
1380
1415
        $(call cmd,rmdirs)
1381
1416
        $(call cmd,rmfiles)
1382
 
        @find $(or $(KBUILD_EXTMOD), .) $(RCS_FIND_IGNORE) \
 
1417
        @find $(if $(KBUILD_EXTMOD), $(KBUILD_EXTMOD), .) $(RCS_FIND_IGNORE) \
1383
1418
                \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
1384
1419
                -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
1385
1420
                -o -name '*.symtypes' -o -name 'modules.order' \
1391
1426
quiet_cmd_tags = GEN     $@
1392
1427
      cmd_tags = $(CONFIG_SHELL) $(srctree)/scripts/tags.sh $@
1393
1428
 
1394
 
tags TAGS cscope: FORCE
 
1429
tags TAGS cscope gtags: FORCE
1395
1430
        $(call cmd,tags)
1396
1431
 
1397
1432
# Scripts to check various things for consistency
1398
1433
# ---------------------------------------------------------------------------
1399
1434
 
 
1435
PHONY += includecheck versioncheck coccicheck namespacecheck export_report
 
1436
 
1400
1437
includecheck:
1401
 
        find * $(RCS_FIND_IGNORE) \
 
1438
        find $(srctree)/* $(RCS_FIND_IGNORE) \
1402
1439
                -name '*.[hcS]' -type f -print | sort \
1403
1440
                | xargs $(PERL) -w $(srctree)/scripts/checkincludes.pl
1404
1441
 
1405
1442
versioncheck:
1406
 
        find * $(RCS_FIND_IGNORE) \
 
1443
        find $(srctree)/* $(RCS_FIND_IGNORE) \
1407
1444
                -name '*.[hcS]' -type f -print | sort \
1408
1445
                | xargs $(PERL) -w $(srctree)/scripts/checkversion.pl
1409
1446
 
1500
1537
 
1501
1538
# Run depmod only if we have System.map and depmod is executable
1502
1539
quiet_cmd_depmod = DEPMOD  $(KERNELRELEASE)
1503
 
      cmd_depmod = \
1504
 
        if [ -r System.map -a -x $(DEPMOD) ]; then                              \
1505
 
                $(DEPMOD) -ae -F System.map                                     \
1506
 
                $(if $(strip $(INSTALL_MOD_PATH)), -b $(INSTALL_MOD_PATH) )     \
1507
 
                $(KERNELRELEASE);                                               \
1508
 
        fi
 
1540
      cmd_depmod = $(CONFIG_SHELL) $(srctree)/scripts/depmod.sh $(DEPMOD) \
 
1541
                   $(KERNELRELEASE)
1509
1542
 
1510
1543
# Create temporary dir for module support files
1511
1544
# clean it up only when building all modules