-
Notifications
You must be signed in to change notification settings - Fork 23
/
Makefile
93 lines (70 loc) · 2.69 KB
/
Makefile
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
CROSS=xenon-
CC=$(CROSS)gcc
OBJCOPY=$(CROSS)objcopy
LD=$(CROSS)ld
AS=$(CROSS)as
STRIP=$(CROSS)strip
RELEASE=0.3
# Configuration
CFLAGS = -Wall -O2 -I. -Ilwip/include \
-Iinclude -I./lwip/include/ipv4 -Ilwip/arch/xenon/include \
-m64 -mno-toc -DBYTE_ORDER=BIG_ENDIAN -mno-altivec \
-I nocfe -D_CFE_=1 -DENDIAN_BIG=1
ifdef CYGNOS
CFLAGS += -DCYGNOS
endif
AFLAGS = -Iinclude -m64
LDFLAGS = -nostdlib -n
#-DLWIP_DEBUG -O2
#-Werror
OBJS = crt0.o main_ardl_.o string_asm.o string.o ctype.o video.o console.o exi.o \
LWIP_OBJS = ./lwip/core/tcp_in.o \
./lwip/core/inet.o ./lwip/core/mem.o ./lwip/core/memp.o \
./lwip/core/netif.o ./lwip/core/pbuf.o ./lwip/core/stats.o ./lwip/core/sys.o \
./lwip/core/tcp.o ./lwip/core/ipv4/ip_addr.o ./lwip/core/ipv4/icmp.o \
./lwip/core/ipv4/ip.o ./lwip/core/ipv4/ip_frag.o \
./lwip/core/tcp_out.o \
./lwip/core/udp.o ./lwip/netif/etharp.o ./lwip/netif/loopif.o ./lwip/core/dhcp.o \
./lwip/core/raw.o \
./lwip/arch/xenon/lib.o ./lwip/arch/xenon/netif/enet.o
USB_OBJS = \
usb/ohci.o usb/usbd.o usb/usbdebug.o usb/usbdevs.o usb/usbhid.o usb/usbhub.o usb/usbmain.o usb/usbmass.o \
nocfe/lib_malloc.o nocfe/lib_queue.o fat.o flash.o
# usb/dev_usb_asix.o usb/dev_usb_catc.o usb/dev_usb_klsi.o usb/dev_usb_pegasus.o usb/dev_usb_rtek.o usb/ohci.o usb/usbd.o usb/usbdebug.o usb/usbdevs.o usb/usbeth.o usb/usbhack.o usb/usbhid.o usb/usbhub.o usb/usbmain.o usb/usbmass.o usb/usbserial.o
OBJS = startup2.o main.o string.o vsprintf.o ctype.o time.o \
cache.o $(LWIP_OBJS) network.o tftp.o httpd/httpd.o httpd/vfs.o dtc.o \
cdrom.o xenos.o font_8x16.o xenos_init.o xenon_smc.o $(USB_OBJS) \
./diskio.o
BUILD = xell-serial xell-readcd xell-1f xell-xell
TARGETS = $(foreach name,$(BUILD),$(addprefix $(name).,bin elf elf32))
# Build rules
all: $(TARGETS)
.SECONDARY: $(OBJS)
.PHONY: clean version.h
clean:
rm -rf $(OBJS) $(TARGETS)
version.h:
@echo 'Creating version.h'
@echo '/* AUTO GENERATED BY make. DO NOT EDIT! */' > version.h
@echo '' >> version.h
@echo '#define RELEASE "$(RELEASE)"' >> version.h
@echo '#define BLAME "'$(shell id -u -n)'@'$(shell uname -n -m)'"' >> version.h
@date +'#define DATE "%F"' >> version.h
@echo '#define GITREV "'$(shell git log --format="%h" HEAD^..HEAD)'"' >> version.h
@echo '' >> version.h
@echo '#define VERSION RELEASE "-git-" GITREV' >> version.h
@echo '#define LONGVERSION VERSION " " DATE " (" BLAME ")"' >> version.h
main.o: version.h
xenos.o: version.h
.c.o:
$(CC) $(CFLAGS) -c -o $@ $*.c
.S.o:
$(CC) $(AFLAGS) -c -o $@ $*.S
%.elf: %.lds $(OBJS)
$(CC) -n -T $< -nostdlib -m64 -o $@ $(OBJS)
%.elf32: %.elf
$(OBJCOPY) -O elf32-powerpc $< $@
$(STRIP) -s $@
%.bin: %.elf
$(OBJCOPY) -O binary $< $@
echo -n "xxxxxxxxxxxxxxxx" >> $@