Skip to content

Commit

Permalink
Makefile: Unify rules for target-tools, narrow down on dependencies
Browse files Browse the repository at this point in the history
This appends sunxi-meminfo to the TARGET_TOOLS, and adds a new rule
to fix the compilation of sunxi-pio (by making it *cross-compile*
for the target).

Additionally adds a new build target "make install-misc".

For more details, see github issues linux-sunxi#69 and linux-sunxi#70.

Signed-off-by: Bernhard Nortmann <bernhard.nortmann@web.de>
  • Loading branch information
n1tehawk committed Oct 29, 2016
1 parent 5244e88 commit 209633a
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ TOOLS = sunxi-fexc sunxi-bootinfo sunxi-fel sunxi-nand-part
FEXC_LINKS = bin2fex fex2bin

# Tools which are only useful on the target
TARGET_TOOLS = sunxi-pio
TARGET_TOOLS = sunxi-meminfo sunxi-pio

# Misc tools (of more "exotic" nature) not part of our default build / install
MISC_TOOLS = phoenix_info sunxi-nand-image-builder

# ARM binaries and images
Expand All @@ -61,7 +62,7 @@ target-tools: $(TARGET_TOOLS)

all: tools target-tools

misc: version.h $(MISC_TOOLS)
misc: $(MISC_TOOLS)

binfiles: $(BINFILES)

Expand All @@ -83,12 +84,18 @@ install-target-tools: $(TARGET_TOOLS)
install -m0755 $$t $(DESTDIR)$(BINDIR)/$$t ; \
done

install-misc: $(MISC_TOOLS)
install -d $(DESTDIR)$(BINDIR)
@set -ex ; for t in $^ ; do \
install -m0755 $$t $(DESTDIR)$(BINDIR)/$$t ; \
done


clean:
@rm -vf $(TOOLS) $(FEXC_LINKS) $(TARGET_TOOLS) $(MISC_TOOLS)
@rm -vf version.h *.o *.elf *.sunxi *.bin *.nm *.orig

$(TOOLS) $(TARGET_TOOLS): Makefile common.h version.h
$(TOOLS) $(TARGET_TOOLS) $(MISC_TOOLS): Makefile common.h version.h

fex2bin bin2fex: sunxi-fexc
ln -nsf $< $@
Expand All @@ -113,6 +120,8 @@ sunxi-nand-part: nand-part-main.c nand-part.c nand-part-a10.h nand-part-a20.h

sunxi-%: %.c
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(filter %.c,$^) $(LIBS)
phoenix_info: phoenix_info.c
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS)

%.bin: %.elf
$(CROSS_COMPILE)objcopy -O binary $< $@
Expand Down Expand Up @@ -153,11 +162,14 @@ boot_head_sun5i.elf: boot_head.S boot_head.lds

sunxi-bootinfo: bootinfo.c

# target tools
TARGET_CFLAGS = -g -O0 -Wall -Wextra -std=c99 $(DEFINES) -Iinclude/ -static
sunxi-pio: pio.c
$(CROSS_COMPILE)gcc $(TARGET_CFLAGS) -o $@ $<
sunxi-meminfo: meminfo.c
$(CROSS_COMPILE)gcc -g -O0 -Wall -static -o $@ $^

$(CROSS_COMPILE)gcc $(TARGET_CFLAGS) -o $@ $<
sunxi-script_extractor: script_extractor.c
$(CROSS_COMPILE)gcc -g -O0 -Wall -static -o $@ $^
$(CROSS_COMPILE)gcc $(TARGET_CFLAGS) -o $@ $<

version.h:
@./autoversion.sh > $@
Expand Down

0 comments on commit 209633a

Please sign in to comment.