Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Sunxi Tools
Commits
1c3a6ca5
Commit
1c3a6ca5
authored
Nov 03, 2016
by
NiteHawk
Committed by
GitHub
Nov 03, 2016
Browse files
Merge pull request #75 from n1tehawk/contrib
Makefile: Ensure that user-supplied CFLAGS get respected
parents
9d4658f9
bb4c2a6b
Changes
2
Hide whitespace changes
Inline
Side-by-side
.travis.yml
View file @
1c3a6ca5
...
...
@@ -3,8 +3,9 @@ sudo: false
language
:
c
# treat all warnings as errors
env
:
EXTRA_CFLAGS=-Werror
# treat all warnings as errors, fake cross-toolchain (build everything on host)
env
:
-
CFLAGS=-Werror CROSS_COMPILE=""
os
:
-
linux
...
...
@@ -26,24 +27,23 @@ addons:
packages
:
-
libusb-1.0-0-dev
# take care of the libusb dependency for Mac OS X;
on Linux use "make all" later
# take care of the libusb dependency for Mac OS X;
select make/install target
before_install
:
-
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
brew update;
brew install libusb;
export TARGET=tools;
else
export TARGET=
"
all
CROSS_COMPILE="
;
export TARGET=all;
fi
# build using the Makefile
script
:
-
make ${TARGET} && make misc
#
when on Linux:
run/simulate a test install
# run/simulate a test install
after_success
:
-
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
make install-all install-misc DESTDIR=/tmp PREFIX=/sunxi-tools;
fi
-
make install-${TARGET} install-misc DESTDIR=/tmp PREFIX=/sunxi-tools
# turn off email notifications
notifications
:
...
...
Makefile
View file @
1c3a6ca5
...
...
@@ -17,21 +17,21 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
CC
?=
gcc
CFLAGS
=
-g
-O0
-Wall
-Wextra
$(EXTRA_CFLAGS)
CFLAGS
+=
-std
=
c99
$(DEFINES)
CFLAGS
+=
-Iinclude
/
DEFAULT_CFLAGS
:=
-g
-O0
-Wall
-Wextra
-std
=
c99
DEF
INE
S
=
-D_POSIX_C_SOURCE
=
200112L
DEF
AULT_CFLAG
S
+
=
-D_POSIX_C_SOURCE
=
200112L
# Define _BSD_SOURCE, necessary to expose all endian conversions properly.
# See http://linux.die.net/man/3/endian
DEF
INE
S
+=
-D_BSD_SOURCE
DEF
AULT_CFLAG
S
+=
-D_BSD_SOURCE
# glibc 2.20+ also requires _DEFAULT_SOURCE
DEF
INE
S
+=
-D_DEFAULT_SOURCE
DEF
AULT_CFLAG
S
+=
-D_DEFAULT_SOURCE
ifeq
(NetBSD,$(OS))
# add explicit _NETBSD_SOURCE, see https://github.com/linux-sunxi/sunxi-tools/pull/22
DEF
INE
S
+=
-D_NETBSD_SOURCE
DEF
AULT_CFLAG
S
+=
-D_NETBSD_SOURCE
endif
DEFAULT_CFLAGS
+=
-Iinclude
/
# Tools useful on host and target
TOOLS
=
sunxi-fexc sunxi-bootinfo sunxi-fel sunxi-nand-part
...
...
@@ -49,6 +49,7 @@ MISC_TOOLS = phoenix_info sunxi-nand-image-builder
BINFILES
=
fel-pio.bin jtag-loop.sunxi fel-sdboot.sunxi uart0-helloworld-sdboot.sunxi
CROSS_COMPILE
?=
arm-none-eabi-
CROSS_CC
?=
$(CROSS_COMPILE)
gcc
MKSUNXIBOOT
?=
mksunxiboot
DESTDIR
?=
...
...
@@ -110,24 +111,26 @@ LIBUSB_CFLAGS ?= `pkg-config --cflags $(LIBUSB)`
LIBUSB_LIBS
?=
`
pkg-config
--libs
$(LIBUSB)
`
ifeq
($(OS),Windows_NT)
# Windows lacks mman.h / mmap()
DEF
INE
S
+=
-DNO_MMAP
DEF
AULT_CFLAG
S
+=
-DNO_MMAP
# portable_endian.h relies on winsock2
LIBS
+=
-lws2_32
endif
HOST_CFLAGS
=
$(DEFAULT_CFLAGS)
$(CFLAGS)
sunxi-fel
:
fel.c fel-to-spl-thunk.h progress.c progress.h
$(CC)
$(CFLAGS)
$(LIBUSB_CFLAGS)
$(LDFLAGS)
-o
$@
$(
filter
%.c,
$^
)
$(LIBS)
$(LIBUSB_LIBS)
$(CC)
$(
HOST_
CFLAGS)
$(LIBUSB_CFLAGS)
$(LDFLAGS)
-o
$@
$(
filter
%.c,
$^
)
$(LIBS)
$(LIBUSB_LIBS)
sunxi-nand-part
:
nand-part-main.c nand-part.c nand-part-a10.h nand-part-a20.h
$(CC)
$(CFLAGS)
-c
-o
nand-part-main.o nand-part-main.c
$(CC)
$(CFLAGS)
-c
-o
nand-part-a10.o nand-part.c
-D
A10
$(CC)
$(CFLAGS)
-c
-o
nand-part-a20.o nand-part.c
-D
A20
$(CC)
$(
HOST_
CFLAGS)
-c
-o
nand-part-main.o nand-part-main.c
$(CC)
$(
HOST_
CFLAGS)
-c
-o
nand-part-a10.o nand-part.c
-D
A10
$(CC)
$(
HOST_
CFLAGS)
-c
-o
nand-part-a20.o nand-part.c
-D
A20
$(CC)
$(LDFLAGS)
-o
$@
nand-part-main.o nand-part-a10.o nand-part-a20.o
$(LIBS)
sunxi-%
:
%.c
$(CC)
$(CFLAGS)
$(LDFLAGS)
-o
$@
$(
filter
%.c,
$^
)
$(LIBS)
$(CC)
$(
HOST_
CFLAGS)
$(LDFLAGS)
-o
$@
$(
filter
%.c,
$^
)
$(LIBS)
phoenix_info
:
phoenix_info.c
$(CC)
$(CFLAGS)
$(LDFLAGS)
-o
$@
$<
$(LIBS)
$(CC)
$(
HOST_
CFLAGS)
$(LDFLAGS)
-o
$@
$<
$(LIBS)
%.bin
:
%.elf
$(CROSS_COMPILE)
objcopy
-O
binary
$<
$@
...
...
@@ -143,39 +146,39 @@ ARM_ELF_FLAGS += -mno-thumb-interwork -fno-stack-protector -fno-toplevel-reorder
ARM_ELF_FLAGS
+=
-Wstrict-prototypes
-Wno-format-nonliteral
-Wno-format-security
fel-pio.elf
:
fel-pio.c fel-pio.lds
$(CROSS_C
OMPILE)
gcc
-g
$(ARM_ELF_FLAGS)
$<
-nostdlib
-o
$@
-T
fel-pio.lds
$(CROSS_C
C)
-g
$(ARM_ELF_FLAGS)
$<
-nostdlib
-o
$@
-T
fel-pio.lds
fel-pio.nm
:
fel-pio.elf
$(CROSS_COMPILE)
nm
$<
|
grep
-v
" _"
>
$@
jtag-loop.elf
:
jtag-loop.c jtag-loop.lds
$(CROSS_C
OMPILE)
gcc
-g
$(ARM_ELF_FLAGS)
$<
-nostdlib
-o
$@
-T
jtag-loop.lds
-Wl
,-N
$(CROSS_C
C)
-g
$(ARM_ELF_FLAGS)
$<
-nostdlib
-o
$@
-T
jtag-loop.lds
-Wl
,-N
fel-sdboot.elf
:
fel-sdboot.S fel-sdboot.lds
$(CROSS_C
OMPILE)
gcc
-g
$(ARM_ELF_FLAGS)
$<
-nostdlib
-o
$@
-T
fel-sdboot.lds
-Wl
,-N
$(CROSS_C
C)
-g
$(ARM_ELF_FLAGS)
$<
-nostdlib
-o
$@
-T
fel-sdboot.lds
-Wl
,-N
uart0-helloworld-sdboot.elf
:
uart0-helloworld-sdboot.c uart0-helloworld-sdboot.lds
$(CROSS_C
OMPILE)
gcc
-g
$(ARM_ELF_FLAGS)
$<
-nostdlib
-o
$@
-T
uart0-helloworld-sdboot.lds
-Wl
,-N
$(CROSS_C
C)
-g
$(ARM_ELF_FLAGS)
$<
-nostdlib
-o
$@
-T
uart0-helloworld-sdboot.lds
-Wl
,-N
boot_head_sun3i.elf
:
boot_head.S boot_head.lds
$(CROSS_C
OMPILE)
gcc
-g
$(ARM_ELF_FLAGS)
$<
-nostdlib
-o
$@
-T
boot_head.lds
-Wl
,-N
-DMACHID
=
0x1094
$(CROSS_C
C)
-g
$(ARM_ELF_FLAGS)
$<
-nostdlib
-o
$@
-T
boot_head.lds
-Wl
,-N
-DMACHID
=
0x1094
boot_head_sun4i.elf
:
boot_head.S boot_head.lds
$(CROSS_C
OMPILE)
gcc
-g
$(ARM_ELF_FLAGS)
$<
-nostdlib
-o
$@
-T
boot_head.lds
-Wl
,-N
-DMACHID
=
0x1008
$(CROSS_C
C)
-g
$(ARM_ELF_FLAGS)
$<
-nostdlib
-o
$@
-T
boot_head.lds
-Wl
,-N
-DMACHID
=
0x1008
boot_head_sun5i.elf
:
boot_head.S boot_head.lds
$(CROSS_C
OMPILE)
gcc
-g
$(ARM_ELF_FLAGS)
$<
-nostdlib
-o
$@
-T
boot_head.lds
-Wl
,-N
-DMACHID
=
0x102A
$(CROSS_C
C)
-g
$(ARM_ELF_FLAGS)
$<
-nostdlib
-o
$@
-T
boot_head.lds
-Wl
,-N
-DMACHID
=
0x102A
sunxi-bootinfo
:
bootinfo.c
# target tools
TARGET_CFLAGS
=
-g
-O0
-Wall
-Wextra
-std
=
c99
$(DEFINES)
-Iinclude
/
-static
TARGET_CFLAGS
=
$(DEFAULT_CFLAGS)
-static
$(CFLAGS)
sunxi-pio
:
pio.c
$(CROSS_C
OMPILE)
gcc
$(TARGET_CFLAGS)
-o
$@
$<
$(CROSS_C
C)
$(TARGET_CFLAGS)
-o
$@
$<
sunxi-meminfo
:
meminfo.c
$(CROSS_C
OMPILE)
gcc
$(TARGET_CFLAGS)
-o
$@
$<
$(CROSS_C
C)
$(TARGET_CFLAGS)
-o
$@
$<
sunxi-script_extractor
:
script_extractor.c
$(CROSS_C
OMPILE)
gcc
$(TARGET_CFLAGS)
-o
$@
$<
$(CROSS_C
C)
$(TARGET_CFLAGS)
-o
$@
$<
version.h
:
@
./autoversion.sh
>
$@
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment