-
Notifications
You must be signed in to change notification settings - Fork 18
/
Makefile
56 lines (38 loc) · 1.4 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
ifeq ($(strip $(DEVKITPPC)),)
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC)
endif
.SUFFIXES:
include $(DEVKITPPC)/wii_rules
TARGET = ftpii
SOURCES = source
BUILD = build
CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE)
LDFLAGS = -L$(LIBOGC_LIB) -lntfs -lseeprom -lotp -lisfs -lnandimg -lfst -lwod -liso -ldi -lwiiuse -lbte -lfat -logc -lm -g $(MACHDEP) -Wl,-Map,$(notdir $@).map,--section-start,.init=0x80a00000
PRELOADER_LDFLAGS = -L$(LIBOGC_LIB) -logc -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
ifneq ($(BUILD),$(notdir $(CURDIR)))
export OUTPUT := $(CURDIR)/$(TARGET)
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir))
export DEPSDIR := $(CURDIR)/$(BUILD)
export LD := $(CC)
export OFILES := reset.o dvd.o pad.o net.o fs.o ftp.o loader.o vrt.o dol.o ftpii.o
export PRELOADER_OFILES := _$(TARGET).dol.o dol.o preloader.o
export INCLUDE := -I$(CURDIR)/$(BUILD) -I$(LIBOGC_INC)
.PHONY: $(BUILD) clean run
$(BUILD):
@[ -d $@ ] || mkdir -p $@
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
clean:
@rm -rf $(BUILD) $(TARGET).dol $(TARGET).elf
run:
@wiiload $(TARGET).dol
else
$(OUTPUT).dol: $(OUTPUT).elf
$(OUTPUT).elf: $(PRELOADER_OFILES)
@echo linking ... $(notdir $@)
@$(LD) $^ $(PRELOADER_LDFLAGS) -o $@
%.dol.o: %.dol
@$(bin2o)
_$(TARGET).elf: $(OFILES)
DEPENDS = $(OFILES:.o=.d) $(PRELOADER_OFILES:.o=.d)
-include $(DEPENDS)
endif