Advertisement
Guest User

Untitled

a guest
Sep 26th, 2013
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Make 4.19 KB | None | 0 0
  1. CC = gcc
  2. CFLAGS = -g -O0 -Wall -Wextra
  3. CFLAGS += -std=c99 -D_POSIX_C_SOURCE=200112L
  4. CFLAGS += -Iinclude/
  5.  
  6. TOOLS = fexc bin2fex fex2bin bootinfo fel pio
  7. TOOLS += nand-part
  8.  
  9. MISC_TOOLS = phoenix_info
  10.  
  11. CROSS_COMPILE ?= arm-none-eabi-
  12.  
  13. .PHONY: all clean
  14.  
  15. all: $(TOOLS)
  16.  
  17. misc: $(MISC_TOOLS)
  18.  
  19. clean:
  20.     @rm -vf $(TOOLS) $(MISC_TOOLS) *.o *.elf *.sunxi *.bin *.nm *.orig
  21.  
  22.  
  23. $(TOOLS): Makefile common.h
  24.  
  25. fex2bin bin2fex: fexc
  26.     ln -s $< $@
  27.  
  28. fexc: fexc.h script.h script.c \
  29.     script_uboot.h script_uboot.c \
  30.     script_bin.h script_bin.c \
  31.     script_fex.h script_fex.c
  32.  
  33. LIBUSB = libusb-1.0
  34. LIBUSB_CFLAGS = `pkg-config --cflags $(LIBUSB)`
  35. LIBUSB_LIBS = `pkg-config --libs $(LIBUSB)`
  36.  
  37. fel: fel.c
  38.     $(CC) $(CFLAGS) $(LIBUSB_CFLAGS) $(LDFLAGS) -o $@ $(filter %.c,$^) $(LIBS) $(LIBUSB_LIBS)
  39.  
  40. nand-part: nand-part-main.c nand-part.c nand-part-a10.h nand-part-a20.h
  41.     $(CC) $(CFLAGS) -c -o nand-part-main.o nand-part-main.c
  42.     $(CC) $(CFLAGS) -c -o nand-part-a10.o nand-part.c -D A10
  43.     $(CC) $(CFLAGS) -c -o nand-part-a20.o nand-part.c -D A20
  44.     $(CC) $(LDFLAGS) -o $@ nand-part-main.o nand-part-a10.o nand-part-a20.o $(LIBS)
  45.  
  46. %: %.c
  47.     $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(filter %.c,$^) $(LIBS)
  48.  
  49. fel-pio.bin: fel-pio.elf fel-pio.nm
  50.     $(CROSS_COMPILE)objcopy -O binary fel-pio.elf fel-pio.bin
  51.  
  52. fel-pio.elf: fel-pio.c fel-pio.lds
  53.     $(CROSS_COMPILE)gcc  -g  -Os -fpic  -fno-common -fno-builtin -ffreestanding -nostdinc -mno-thumb-interwork -Wall -Wstrict-prototypes -fno-stack-protector -Wno-format-nonliteral -Wno-format-security -fno-toplevel-reorder  fel-pio.c -nostdlib -o fel-pio.elf -T fel-pio.lds
  54.  
  55. fel-pio.nm: fel-pio.elf
  56.     $(CROSS_COMPILE)nm fel-pio.elf | grep -v " _" >fel-pio.nm
  57.  
  58. jtag-loop.elf: jtag-loop.c jtag-loop.lds
  59.     $(CROSS_COMPILE)gcc  -g  -Os  -fpic -fno-common -fno-builtin -ffreestanding -nostdinc -mno-thumb-interwork -Wall -Wstrict-prototypes -fno-stack-protector -Wno-format-nonliteral -Wno-format-security -fno-toplevel-reorder  jtag-loop.c -nostdlib -o jtag-loop.elf -T jtag-loop.lds -Wl,-N
  60.  
  61. jtag-loop.bin: jtag-loop.elf
  62.     $(CROSS_COMPILE)objcopy -O binary jtag-loop.elf jtag-loop.bin
  63.  
  64. jtag-loop.sunxi: jtag-loop.bin
  65.     mksunxiboot jtag-loop.bin jtag-loop.sunxi
  66.  
  67. fel-sdboot.elf: fel-sdboot.c fel-sdboot.lds
  68.     $(CROSS_COMPILE)gcc  -g  -Os  -fpic -fno-common -fno-builtin -ffreestanding -nostdinc -mno-thumb-interwork -Wall -Wstrict-prototypes -fno-stack-protector -Wno-format-nonliteral -Wno-format-security -fno-toplevel-reorder  fel-sdboot.c -nostdlib -o fel-sdboot.elf -T fel-sdboot.lds -Wl,-N
  69.  
  70. fel-sdboot.bin: fel-sdboot.elf
  71.     $(CROSS_COMPILE)objcopy -O binary fel-sdboot.elf fel-sdboot.bin
  72.  
  73. fel-sdboot.sunxi: fel-sdboot.bin
  74.     mksunxiboot fel-sdboot.bin fel-sdboot.sunxi
  75.  
  76. boot_head_sun3i.elf: boot_head_sun3i.S boot_head_sun3i.lds
  77.     $(CROSS_COMPILE)gcc  -g  -Os  -fpic -fno-common -fno-builtin -ffreestanding -nostdinc -mno-thumb-interwork -Wall -Wstrict-prototypes -fno-stack-protector -Wno-format-nonliteral -Wno-format-security -fno-toplevel-reorder  boot_head.S -nostdlib -o boot_head_sun3i.elf -T boot_head.lds -Wl,-N -DMACHID=0x1094
  78.  
  79. boot_head_sun3i.bin: boot_head_sun3i.elf
  80.     $(CROSS_COMPILE)objcopy -O binary boot_head_sun3i.elf boot_head_sun3i.bin
  81.  
  82. boot_head_sun4i.elf: boot_head.S boot_head.lds
  83.     $(CROSS_COMPILE)gcc  -g  -Os  -fpic -fno-common -fno-builtin -ffreestanding -nostdinc -mno-thumb-interwork -Wall -Wstrict-prototypes -fno-stack-protector -Wno-format-nonliteral -Wno-format-security -fno-toplevel-reorder  boot_head.S -nostdlib -o boot_head_sun4i.elf -T boot_head.lds -Wl,-N -DMACHID=0x1008
  84.  
  85. boot_head_sun4i.bin: boot_head_sun4i.elf
  86.     $(CROSS_COMPILE)objcopy -O binary boot_head_sun4i.elf boot_head_sun4i.bin
  87.  
  88. boot_head_sun5i.elf: boot_head.S boot_head.lds
  89.     $(CROSS_COMPILE)gcc  -g  -Os  -fpic -fno-common -fno-builtin -ffreestanding -nostdinc -mno-thumb-interwork -Wall -Wstrict-prototypes -fno-stack-protector -Wno-format-nonliteral -Wno-format-security -fno-toplevel-reorder  boot_head.S -nostdlib -o boot_head_sun5i.elf -T boot_head.lds -Wl,-N -DMACHID=0x102A
  90.  
  91. boot_head_sun5i.bin: boot_head_sun5i.elf
  92.     $(CROSS_COMPILE)objcopy -O binary boot_head_sun5i.elf boot_head_sun5i.bin
  93.  
  94. bootinfo: bootinfo.c
  95.  
  96. .gitignore: Makefile
  97.     @for x in $(TOOLS) '*.o' '*.swp'; do \
  98.         echo "$$x"; \
  99.     done > $@
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement