|
| 1 | +#--------------------------------------------------------------------------------- |
| 2 | +# FAKE-08 Wii Makefile |
| 3 | +#--------------------------------------------------------------------------------- |
| 4 | + |
| 5 | +ifeq ($(strip $(DEVKITPPC)),) |
| 6 | +$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC") |
| 7 | +endif |
| 8 | + |
| 9 | +include $(DEVKITPPC)/wii_rules |
| 10 | + |
| 11 | +#--------------------------------------------------------------------------------- |
| 12 | +# TARGET is the name of the output |
| 13 | +# BUILD is the directory where object files & intermediate files will be placed |
| 14 | +# SOURCES is a list of directories containing source code |
| 15 | +# INCLUDES is a list of directories containing header files |
| 16 | +#--------------------------------------------------------------------------------- |
| 17 | +TARGET := FAKE-08 |
| 18 | +BUILD := build |
| 19 | +SOURCES := ${SOURCES} ../SDL2Common/source source |
| 20 | +INCLUDES := ${INCLUDES} ../SDL2Common/source source |
| 21 | + |
| 22 | +#--------------------------------------------------------------------------------- |
| 23 | +# options for code generation |
| 24 | +#--------------------------------------------------------------------------------- |
| 25 | + |
| 26 | +CFLAGS := -g -Wall -O2 -ffunction-sections -MMD -MP -DVER_STR=\"$(APP_VERSION)\" \ |
| 27 | + -ffast-math \ |
| 28 | + $(MACHDEP) |
| 29 | + |
| 30 | +CC := $(CXX) |
| 31 | + |
| 32 | +CFLAGS += $(INCLUDE) -D__WII__ -DGEKKO |
| 33 | + |
| 34 | +CXXFLAGS := $(CFLAGS) -std=gnu++17 |
| 35 | + |
| 36 | +ASFLAGS := -g $(MACHDEP) |
| 37 | +LDFLAGS := -g $(MACHDEP) -Wl,-Map,$(notdir $*.map) |
| 38 | + |
| 39 | +LIBS := -lSDL2 -lwiikeyboard -lwiiuse -lbte -lfat -laesnd -logc -lm -lz |
| 40 | + |
| 41 | +#--------------------------------------------------------------------------------- |
| 42 | +# list of directories containing libraries, this must be the top level |
| 43 | +# containing include and lib |
| 44 | +#--------------------------------------------------------------------------------- |
| 45 | +PORTLIBS ?= $(DEVKITPRO)/portlibs/wii |
| 46 | +LIBDIRS := $(PORTLIBS) |
| 47 | + |
| 48 | + |
| 49 | +#--------------------------------------------------------------------------------- |
| 50 | +# no real need to edit anything past this point unless you need to add additional |
| 51 | +# rules for different file extensions |
| 52 | +#--------------------------------------------------------------------------------- |
| 53 | +ifneq ($(BUILD),$(notdir $(CURDIR))) |
| 54 | +#--------------------------------------------------------------------------------- |
| 55 | + |
| 56 | +export OUTPUT := $(CURDIR)/$(TARGET) |
| 57 | +export TOPDIR := $(CURDIR) |
| 58 | + |
| 59 | +export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) |
| 60 | +export DEPSDIR := $(CURDIR)/$(BUILD) |
| 61 | + |
| 62 | +CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) |
| 63 | +CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) |
| 64 | +SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) |
| 65 | + |
| 66 | +#--------------------------------------------------------------------------------- |
| 67 | +# use CXX for linking C++ projects, CC for standard C |
| 68 | +#--------------------------------------------------------------------------------- |
| 69 | +ifeq ($(strip $(CPPFILES)),) |
| 70 | +#--------------------------------------------------------------------------------- |
| 71 | + export LD := $(CC) |
| 72 | +#--------------------------------------------------------------------------------- |
| 73 | +else |
| 74 | +#--------------------------------------------------------------------------------- |
| 75 | + export LD := $(CXX) |
| 76 | +#--------------------------------------------------------------------------------- |
| 77 | +endif |
| 78 | +#--------------------------------------------------------------------------------- |
| 79 | + |
| 80 | +export SRCFILES := $(CPPFILES) $(CFILES) $(SFILES) |
| 81 | +export OFILES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) |
| 82 | +export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ |
| 83 | + $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ |
| 84 | + -I$(CURDIR)/$(BUILD) \ |
| 85 | + -I$(LIBOGC_INC) |
| 86 | + |
| 87 | +export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \ |
| 88 | + -L$(LIBOGC_LIB) |
| 89 | + |
| 90 | +.PHONY: $(BUILD) clean all |
| 91 | + |
| 92 | +#--------------------------------------------------------------------------------- |
| 93 | +all: $(BUILD) |
| 94 | + |
| 95 | +$(BUILD): $(SRCFILES) |
| 96 | + @[ -d $@ ] || mkdir -p $@ |
| 97 | + @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile |
| 98 | + |
| 99 | +#--------------------------------------------------------------------------------- |
| 100 | +clean: |
| 101 | + @echo clean ... |
| 102 | + @rm -fr $(BUILD) $(TARGET).dol $(TARGET).elf |
| 103 | + |
| 104 | +#--------------------------------------------------------------------------------- |
| 105 | +else |
| 106 | +.PHONY: all |
| 107 | + |
| 108 | +DEPENDS := $(OFILES:.o=.d) |
| 109 | + |
| 110 | +#--------------------------------------------------------------------------------- |
| 111 | +# main targets |
| 112 | +#--------------------------------------------------------------------------------- |
| 113 | +all : $(OUTPUT).dol |
| 114 | + |
| 115 | +$(OUTPUT).dol : $(OUTPUT).elf |
| 116 | + |
| 117 | +$(OUTPUT).elf : $(OFILES) |
| 118 | + |
| 119 | +-include $(DEPENDS) |
| 120 | + |
| 121 | +#--------------------------------------------------------------------------------- |
| 122 | +endif |
| 123 | +#--------------------------------------------------------------------------------- |
0 commit comments