root / images / Makefile @ c473cc56
History | View | Annotate | Download (4.3 KB)
| 1 |
# |
|---|---|
| 2 |
# Copyright 2010 Ettus Research LLC |
| 3 |
# |
| 4 |
# This program is free software: you can redistribute it and/or modify |
| 5 |
# it under the terms of the GNU General Public License as published by |
| 6 |
# the Free Software Foundation, either version 3 of the License, or |
| 7 |
# (at your option) any later version. |
| 8 |
# |
| 9 |
# This program is distributed in the hope that it will be useful, |
| 10 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 |
# GNU General Public License for more details. |
| 13 |
# |
| 14 |
# You should have received a copy of the GNU General Public License |
| 15 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 |
# |
| 17 |
|
| 18 |
all: |
| 19 |
@echo "Pick a specific target" |
| 20 |
|
| 21 |
######################################################################## |
| 22 |
# Common Variables |
| 23 |
######################################################################## |
| 24 |
TOP_DIR = $(shell pwd) |
| 25 |
TOP_FW_DIR = $(TOP_DIR)/../firmware |
| 26 |
TOP_FPGA_DIR = $(TOP_DIR)/../fpga |
| 27 |
BUILT_IMAGES_DIR = $(TOP_DIR)/images |
| 28 |
CMAKE_BUILD_DIR = $(TOP_DIR)/build |
| 29 |
|
| 30 |
##filled in below |
| 31 |
IMAGES_LIST = |
| 32 |
|
| 33 |
######################################################################## |
| 34 |
# Utility Checks |
| 35 |
######################################################################## |
| 36 |
ifeq ($(shell sdcc --help > /dev/null 2>&1 && echo $$?),0) |
| 37 |
HAS_SDCC=1 |
| 38 |
endif |
| 39 |
|
| 40 |
ifeq ($(shell mb-gcc --help > /dev/null 2>&1 && echo $$?),0) |
| 41 |
HAS_MB_GCC=1 |
| 42 |
endif |
| 43 |
|
| 44 |
ifeq ($(shell xtclsh -h > /dev/null 2>&1 && echo $$?),0) |
| 45 |
HAS_XTCLSH=1 |
| 46 |
endif |
| 47 |
|
| 48 |
######################################################################## |
| 49 |
# USRP1 firmware |
| 50 |
######################################################################## |
| 51 |
ifdef HAS_SDCC |
| 52 |
|
| 53 |
_usrp1_fw_dir = $(TOP_FW_DIR)/fx2 |
| 54 |
_usrp1_fw_ihx = $(BUILT_IMAGES_DIR)/usrp1_fw.ihx |
| 55 |
IMAGES_LIST += $(_usrp1_fw_ihx) |
| 56 |
|
| 57 |
$(_usrp1_fw_ihx): |
| 58 |
cd $(_usrp1_fw_dir) && rm -rf build |
| 59 |
cd $(_usrp1_fw_dir) && mkdir build |
| 60 |
cd $(_usrp1_fw_dir)/build && cmake ../ |
| 61 |
cd $(_usrp1_fw_dir)/build && make |
| 62 |
cp $(_usrp1_fw_dir)/build/usrp1/usrp1_fw.ihx $@ |
| 63 |
|
| 64 |
endif |
| 65 |
|
| 66 |
######################################################################## |
| 67 |
# USRP1 fpga |
| 68 |
######################################################################## |
| 69 |
_usrp1_fpga_dir = $(TOP_FPGA_DIR)/usrp1/rbf/rev4 |
| 70 |
_usrp1_fpga_rbf = $(BUILT_IMAGES_DIR)/usrp1_fpga.rbf |
| 71 |
_usrp1_fpga_4rx_rbf = $(BUILT_IMAGES_DIR)/usrp1_fpga_4rx.rbf |
| 72 |
IMAGES_LIST += $(_usrp1_fpga_rbf) $(_usrp1_fpga_4rx_rbf) |
| 73 |
|
| 74 |
$(_usrp1_fpga_rbf): |
| 75 |
cp $(_usrp1_fpga_dir)/std_2rxhb_2tx.rbf $@ |
| 76 |
|
| 77 |
$(_usrp1_fpga_4rx_rbf): |
| 78 |
cp $(_usrp1_fpga_dir)/std_4rx_0tx.rbf $@ |
| 79 |
|
| 80 |
######################################################################## |
| 81 |
# USRP2 firmware |
| 82 |
######################################################################## |
| 83 |
ifdef HAS_MB_GCC |
| 84 |
|
| 85 |
_usrp2_fw_dir = $(TOP_FW_DIR)/microblaze |
| 86 |
_usrp2_fw_bin = $(BUILT_IMAGES_DIR)/usrp2_fw.bin |
| 87 |
IMAGES_LIST += $(_usrp2_fw_bin) |
| 88 |
|
| 89 |
$(_usrp2_fw_bin): |
| 90 |
cd $(_usrp2_fw_dir) && ./bootstrap |
| 91 |
cd $(_usrp2_fw_dir) && ./configure --host=mb |
| 92 |
make -C $(_usrp2_fw_dir) clean |
| 93 |
make -C $(_usrp2_fw_dir) all |
| 94 |
cp $(_usrp2_fw_dir)/usrp2/usrp2_txrx_uhd.bin $@ |
| 95 |
|
| 96 |
endif |
| 97 |
|
| 98 |
######################################################################## |
| 99 |
# USRP2 fpga |
| 100 |
######################################################################## |
| 101 |
ifdef HAS_XTCLSH |
| 102 |
|
| 103 |
_usrp2_fpga_dir = $(TOP_FPGA_DIR)/usrp2/top/u2_rev3 |
| 104 |
_usrp2_fpga_bin = $(BUILT_IMAGES_DIR)/usrp2_fpga.bin |
| 105 |
IMAGES_LIST += $(_usrp2_fpga_bin) |
| 106 |
|
| 107 |
$(_usrp2_fpga_bin): |
| 108 |
cd $(_usrp2_fpga_dir) && make -f Makefile.udp clean |
| 109 |
cd $(_usrp2_fpga_dir) && make -f Makefile.udp bin |
| 110 |
cp $(_usrp2_fpga_dir)/build-udp/u2_rev3.bin $@ |
| 111 |
|
| 112 |
endif |
| 113 |
|
| 114 |
######################################################################## |
| 115 |
# Build rules |
| 116 |
######################################################################## |
| 117 |
##little rule to make the images directory |
| 118 |
$(BUILT_IMAGES_DIR): |
| 119 |
mkdir $@ |
| 120 |
|
| 121 |
images: $(BUILT_IMAGES_DIR) $(IMAGES_LIST) |
| 122 |
chmod -x $(BUILT_IMAGES_DIR)/* |
| 123 |
|
| 124 |
clean: |
| 125 |
$(RM) -rf $(BUILT_IMAGES_DIR) |
| 126 |
$(RM) -rf $(CMAKE_BUILD_DIR) |
| 127 |
|
| 128 |
#packages that a linux machine can build |
| 129 |
linux-packages: |
| 130 |
mkdir -p $(CMAKE_BUILD_DIR) |
| 131 |
|
| 132 |
cd $(CMAKE_BUILD_DIR) && cmake -DCPACK_GENERATOR=TGZ $(TOP_DIR) |
| 133 |
make -C $(CMAKE_BUILD_DIR) package |
| 134 |
|
| 135 |
cd $(CMAKE_BUILD_DIR) && cmake -DCPACK_GENERATOR=ZIP $(TOP_DIR) |
| 136 |
make -C $(CMAKE_BUILD_DIR) package |
| 137 |
|
| 138 |
cd $(CMAKE_BUILD_DIR) && cmake -DCPACK_GENERATOR=DEB $(TOP_DIR) |
| 139 |
make -C $(CMAKE_BUILD_DIR) package |
| 140 |
|
| 141 |
cd $(CMAKE_BUILD_DIR) && cmake -DCPACK_GENERATOR=RPM $(TOP_DIR) |
| 142 |
make -C $(CMAKE_BUILD_DIR) package |