RT-AC66 3.0.0.4.374.130 core
[tomato.git] / release / src / router / common.mak
blobd673a24b939d0651cbe535cc8868fdef26cf1094
1 ifeq ($(SRCBASE),)
2 # ..../src/router/
3 # (directory of the last (this) makefile)
4 # src or src-rt, regardless of symlink for router directory.
5 export TOP := $(shell cd $(dir $(lastword $(MAKEFILE_LIST))) && pwd -P)
6 export TOP := $(PWD)/$(notdir $(TOP))
8 # ..../src/
9 export SRCBASE := $(shell (cd $(TOP)/.. && pwd -P))
11 ifneq ("" , "$(filter-out src_ src-rt_ , $(notdir $(SRCBASE))_)")
12 $(error ERROR: Build must be done from release/src or release/src-rt directory)
13 endif
14 else
15 export TOP := $(SRCBASE)/router
16 endif
18 include $(SRCBASE)/tomato_profile.mak
19 include $(TOP)/.config
21 export BUILD := $(shell (gcc -dumpmachine))
22 export HOSTCC := gcc
24 export PLATFORM := mipsel-uclibc
26 export CROSS_COMPILE := mipsel-uclibc-
27 export CROSS_COMPILER := $(CROSS_COMPILE)
28 export CONFIGURE := ./configure --host=mipsel-linux --build=$(BUILD)
29 export TOOLCHAIN := $(shell cd $(dir $(shell which $(CROSS_COMPILE)gcc))/.. && pwd -P)
31 export CC := $(CROSS_COMPILE)gcc
32 export AR := $(CROSS_COMPILE)ar
33 export AS := $(CROSS_COMPILE)as
34 export LD := $(CROSS_COMPILE)ld
35 export NM := $(CROSS_COMPILE)nm
36 export RANLIB := $(CROSS_COMPILE)ranlib
37 export STRIP := $(CROSS_COMPILE)strip -R .note -R .comment
38 export SIZE := $(CROSS_COMPILE)size
40 include $(SRCBASE)/target.mak
42 # Determine kernel version
43 kver=$(subst ",,$(word 3, $(shell grep "UTS_RELEASE" $(LINUXDIR)/include/linux/$(1))))
45 LINUX_KERNEL=$(call kver,version.h)
46 ifeq ($(LINUX_KERNEL),)
47 LINUX_KERNEL=$(call kver,utsrelease.h)
48 endif
50 export LIBDIR := $(TOOLCHAIN)/lib
51 export USRLIBDIR := $(TOOLCHAIN)/usr/lib
53 export PLATFORMDIR := $(TOP)/$(PLATFORM)
54 export INSTALLDIR := $(PLATFORMDIR)/install
55 export TARGETDIR := $(PLATFORMDIR)/target
57 ifeq ($(EXTRACFLAGS),)
58 export EXTRACFLAGS := -DBCMWPA2 -fno-delete-null-pointer-checks -mips32 -mtune=mips32
59 endif
61 CPTMP = @[ -d $(TOP)/dbgshare ] && cp $@ $(TOP)/dbgshare/ || true
63 ifeq ($(CONFIG_LINUX26),y)
64 export KERNELCC := $(CC)
65 else
66 export KERNELCC := $(CC)-3.4.6
67 endif
69 # ifneq ($(STATIC),1)
70 # SIZECHECK = @$(SRCBASE)/btools/sizehistory.pl $@ $(TOMATO_PROFILE_L)_$(notdir $@)
71 # else
72 SIZECHECK = @$(SIZE) $@
73 # endif