1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
|
#!/usr/bin/make -f
# -*- makefile -*-
# Uncomment this to turn on verbose mode.
# export DH_VERBOSE=1
include /usr/share/dpkg/architecture.mk
include /usr/share/dpkg/pkg-info.mk
TARGET := arm-none-eabi
TOP_DIR := $(shell pwd)
BUILD_DIR := $(TOP_DIR)/build/
BUILD_NANO_DIR := $(TOP_DIR)/build_nano/
TMP_DIR := debian/tmp
TMP_NANO_DIR := debian/tmp_nano
CFLAGS := CFLAGS="-g -O2 -ffunction-sections -fdata-sections"
CFLAGS_NANO := CFLAGS="-g -Os -ffunction-sections -fdata-sections -fshort-wchar"
TARGET_TOOLS = \
CC_FOR_TARGET=$(TARGET)-gcc \
GCC_FOR_TARGET=$(TARGET)-gcc \
AR_FOR_TARGET=$(TARGET)-ar \
AS_FOR_TARGET=$(TARGET)-as \
LD_FOR_TARGET=$(TARGET)-ld \
NM_FOR_TARGET=$(TARGET)-nm \
OBJDUMP_FOR_TARGET=$(TARGET)-objdump \
RANLIB_FOR_TARGET=$(TARGET)-ranlib \
READELF_FOR_TARGET=$(TARGET)-readelf \
STRIP_FOR_TARGET=$(TARGET)-strip
CONFIGURE_COMMON_FLAGS = \
--host=$(DEB_HOST_MULTIARCH) \
--target=$(TARGET) \
--prefix=/usr/lib \
--libdir=/usr/lib \
--infodir=/usr/share/doc/$(DEB_SOURCE)/info \
--mandir=/usr/share/man \
--htmldir=/usr/share/doc/$(DEB_SOURCE)/html \
--pdfdir=/usr/share/doc/$(DEB_SOURCE)/pdf \
--with-pkgversion=$(DEB_VERSION) \
--disable-newlib-supplied-syscalls \
--disable-nls \
$(TARGET_TOOLS)
CONFIGURE_FLAGS = \
--enable-newlib-io-long-long \
--enable-newlib-register-fini \
$(CFLAGS) \
$(CONFIGURE_COMMON_FLAGS)
CONFIGURE_FLAGS_NANO = \
--enable-newlib-reent-small \
--disable-newlib-fvwrite-in-streamio \
--disable-newlib-fseek-optimization \
--disable-newlib-wide-orient \
--enable-newlib-nano-malloc \
--disable-newlib-unbuf-stream-opt \
--enable-lite-exit \
--enable-newlib-global-atexit \
--enable-newlib-nano-formatted-io \
$(CFLAGS_NANO) \
$(CONFIGURE_COMMON_FLAGS)
%:
dh $@ -B$(BUILD_DIR) --with autotools-dev --parallel
override_dh_clean:
dh_clean
rm -rf $(BUILD_DIR) $(BUILD_NANO_DIR) $(TMP_NANO_DIR)
override_dh_auto_configure:
dh_auto_configure -B$(BUILD_DIR) -- $(CONFIGURE_FLAGS)
dh_auto_configure -B$(BUILD_NANO_DIR) -- $(CONFIGURE_FLAGS_NANO)
override_dh_auto_test:
dh_auto_test -B$(BUILD_DIR)
dh_auto_test -B$(BUILD_NANO_DIR)
override_dh_auto_build:
dh_auto_build -B$(BUILD_DIR)
dh_auto_build -B$(BUILD_NANO_DIR)
override_dh_auto_install:
dh_auto_install -B$(BUILD_DIR) --max-parallel=1
dh_auto_install -B$(BUILD_NANO_DIR) --destdir debian/tmp_nano --max-parallel=1
#
# Rename nano lib* files to lib*_nano
find $(TMP_NANO_DIR) -regex ".*/lib\(c\|g\|rdimon\)\.a" \
-exec rename 's@$(TMP_NANO_DIR)/(.*).a@$(TMP_DIR)/$$1_nano.a@' \{\} \+
#
# Move nano's version of newlib.h to nano/newlib.h
mkdir -p $(TMP_DIR)/usr/lib/$(TARGET)/include/nano
mv $(TMP_NANO_DIR)/usr/lib/$(TARGET)/include/newlib.h \
$(TMP_DIR)/usr/lib/$(TARGET)/include/nano/newlib.h
override_dh_installchangelogs:
dh_installchangelogs ChangeLog
override_dh_installdocs:
set -ex; \
cd $(BUILD_DIR)/$(TARGET)/newlib; \
make html-recursive; \
cd -;
dh_installdocs
|