source: branches/contrib/rules/debwrt.mk @ 707

Last change on this file since 707 was 707, checked in by ehem, 5 years ago

Drag in changes to trunk

Coordination is interesting to deal with. Drag in changes that were done
on trunk.

File size: 5.1 KB
Line 
1# DebWrt - Debian on Embedded devices
2#
3# Copyright (C) 2010 Johan van Zoomeren <amain@debwrt.net>
4#
5# This program is free software: you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation, either version 3 of the License, or
8# (at your option) any later version.
9#
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
18RELEASE:=unstable
19BUILD_CYCLE_ID:=
20VERSION:=$(BUILD_CYCLE_ID)
21RELEASE_DATE=$(shell LC_ALL=c date +"%d %B %Y")
22SVN_REVISION:=$(call get_svn_revision)
23DEBWRTVERSION:=$(RELEASE) - $(VERSION) - [ $(RELEASE_DATE) ($(SVN_REVISION)) ]
24ifeq ($(VERSION),)
25    DEBWRT_VERSION:=$(RELEASE)
26else
27    DEBWRT_VERSION:=$(RELEASE)-$(VERSION)
28endif
29
30empty:=
31space:= $(empty) $(empty)
32
33# Include DebWrt config
34-include $(TOPDIR)/.config
35
36# Target arch
37TARGET_ARCH:=$(call qstrip,$(CONFIG_ARCH))
38
39# Board
40# Example:
41#      target    : ar71xx
42#      sub_target: generic
43#      profile   : ubntrspro
44TARGET:=$(shell $(SCRIPT_GET_TARGET) target $(TOPDIR)/.config)
45SUB_TARGET:=$(shell $(SCRIPT_GET_TARGET) subtarget $(TOPDIR)/.config)
46PROFILE:=$(shell $(SCRIPT_GET_TARGET) profile $(TOPDIR)/.config)
47
48# Linux version [2.6.X(.X)]
49LINUX_VERSION:=$(call qstrip,$(CONFIG_DEBWRT_KERNEL_VERSION))
50
51# OpenWrt Branch to checkout [trunk|<otherbranchname>]
52OPENWRT_BRANCH:=$(call qstrip,$(CONFIG_OPENWRT_BRANCH))
53
54# OpenWrt Release Tag to checkout
55OPENWRT_TAG:=$(call qstrip,$(CONFIG_OPENWRT_TAG))
56
57# OpenWrt Revision to checkout [suitable for `svn -r XXXXX`]
58OPENWRT_REVISION:=$(call qstrip,$(CONFIG_OPENWRT_REVISION))
59
60# bin/delivery dir
61BIN_DIR:=$(TOPDIR)/bin
62
63# build dir
64BUILD_DIR:=$(TOPDIR)/build
65
66# tmp dir
67TMP_DIR:=$(TOPDIR)/tmp
68
69# Config dir
70CONFIG_DIR:=$(TOPDIR)/config
71
72# Plugins dir
73PLUGINS_DIR:=$(TOPDIR)/plugins
74
75# Base BuildDir
76BUILD_DIR_BASE:=$(BUILD_DIR)/$(DEBWRT_VERSION)
77
78# Install dir
79INSTALL_DIR_BASE:=$(BIN_DIR)/$(DEBWRT_VERSION)
80
81# Install dir for OpenWrt binaries
82INSTALL_DIR_OPENWRT:=$(INSTALL_DIR_BASE)/firmware/${TARGET_ARCH}/$(TARGET)/$(SUB_TARGET)
83
84# Install dir OpenWrt kernel modules
85INSTALL_DIR_OPENWRT_MODULES:=$(INSTALL_DIR_OPENWRT)/modules
86
87# Install dir OpenWrt packages
88INSTALL_DIR_OPENWRT_PACKAGES:=$(INSTALL_DIR_OPENWRT)/packages
89
90# Install dic OpenWrt kernel headers
91INSTALL_DIR_OPENWRT_HEADERS:=$(INSTALL_DIR_OPENWRT)/headers
92
93# Image file containing OpenWrt kernel modules
94MODULES_TAR_GZ=debwrt-modules-$(TARGET_ARCH)-$(TARGET)-$(SUB_TARGET)-$(OPENWRT_LINUX_UNAME_VERSION)-$(DEBWRT_VERSION).tar.gz
95
96# Image file containing OpenWrt kernel headers
97HEADERS_TAR_GZ=debwrt-headers-$(TARGET_ARCH)-$(TARGET)-$(SUB_TARGET)-$(OPENWRT_LINUX_UNAME_VERSION)-$(DEBWRT_VERSION).tar.gz
98
99# Filename of DebWrt firmware image
100TARGET_IMAGE_NAME_BIN=debwrt-firmware-$(TARGET)-$(SUB_TARGET)-$(OPENWRT_LINUX_UNAME_VERSION)-$(DEBWRT_VERSION).bin
101TARGET_IMAGE_NAME_TRX=debwrt-firmware-$(TARGET)-$(SUB_TARGET)-$(OPENWRT_LINUX_UNAME_VERSION)-$(DEBWRT_VERSION).trx
102
103# OpenWrt patches directory
104PATCHES_DIR_OPENWRT=$(TOPDIR)/openwrt/patches
105
106# OpenWrt files directory
107FILES_DIR_OPENWRT=$(TOPDIR)/openwrt/files
108
109# OpenWrt Build (checkout) directory
110ifeq ($(OPENWRT_TAG),)
111OPENWRT_BUILD_DIR:=$(BUILD_DIR_BASE)/openwrt/$(TARGET_ARCH)/$(TARGET)/$(SUB_TARGET)/$(OPENWRT_BRANCH)-$(OPENWRT_REVISION)
112else
113OPENWRT_BUILD_DIR:=$(BUILD_DIR_BASE)/openwrt/$(TARGET_ARCH)/$(TARGET)/$(SUB_TARGET)/$(OPENWRT_TAG)
114endif
115
116# Special saved environment variables during OpenWrt's build process
117OPENWRT_SAVE_CONFIG_FILE:=$(OPENWRT_BUILD_DIR)/.openwrt_env
118
119# Alternate OpenWrt download directory
120OPENWRT_DOWNLOAD_DIR:=$(call qstrip,$(CONFIG_OPENWRT_DOWNLOAD_DIR))
121
122# Debian
123DEBIAN_BUILD_DIR:=$(BUILD_DIR_BASE)/debian-$(TARGET)-$(SUB_TARGET)-$(DEBIAN_BUILD_VERSION)
124
125DEBIAN_BUILD_PKG_DIR:=$(BUILD_DIR_BASE)/debian-buildhost-$(DEBIAN_BUILD_VERSION)
126
127# Debian packages dir
128DEBIAN_PACKAGES_HOST_DIR:=$(TOPDIR)/debian/package-host
129DEBIAN_PACKAGES_BUILD_DIR:=$(TOPDIR)/debian/package-build
130INSTALL_DIR_DEBIAN_PACKAGES:=$(INSTALL_DIR)/debian
131
132INSTALL_DIR_DEBIAN_BUILD:=$(BIN_DIR)/debian-buildhost-$(DEBIAN_BUILD_VERSION)
133
134# Debian rootfs
135ROOTFS_DEBIAN_ARCH:=$(call qstrip,$(CONFIG_ROOTFS_DEBIAN_ARCH))
136ROOTFS_DEBIAN_RELEASE:=$(call qstrip,$(CONFIG_ROOTFS_DEBIAN_RELEASE))
137ROOTFS_BUILD_DIR:=$(BUILD_DIR_BASE)/rootfs/$(ROOTFS_DEBIAN_RELEASE)/${ROOTFS_DEBIAN_ARCH}
138ROOTFS_INSTALL_DIR:=$(INSTALL_DIR_BASE)/rootfs/$(ROOTFS_DEBIAN_RELEASE)/${ROOTFS_DEBIAN_ARCH}
139
140# Image file containing DebWrt rootfs
141ROOTFS_TAR_BZ2=debwrt-rootfs-$(ROOTFS_DEBIAN_RELEASE)-$(ROOTFS_DEBIAN_ARCH)-$(DEBWRT_VERSION).tar.bz2
142
143# Export defaults to other Makefiles
144export
145
146$(TMP_DIR) $(BIN_DIR) $(OPENWRT_BUILD_DIR) $(BUILD_DIR_BASE) $(DEBIAN_BUILD_DIR) $(DEBIAN_BUILD_PKG_DIR) $(INSTALL_DIR_BASE) $(INSTALL_DIR_OPENWRT) $(INSTALL_DIR_DEBIAN) $(INSTALL_DIR_DEBIAN_BUILD) $(INSTALL_DIR_DEBIAN_PACKAGES): %: %/.dirstamp
147%/.dirstamp:
148        mkdir -p $*
149        touch $@
150
Note: See TracBrowser for help on using the repository browser.