wut/rules/base.mk

52 lines
1.1 KiB
Makefile
Raw Normal View History

2015-12-27 03:10:38 +01:00
ifeq ($(strip $(DEVKITPRO)),)
$(error "Please ensure DEVKITPRO is in your environment.")
endif
ifeq ($(strip $(DEVKITPPC)),)
$(error "Please ensure DEVKITPPC is in your environment.")
endif
2016-07-06 19:46:19 +02:00
export PATH := $(DEVKITPPC)/bin:$(PATH)
2015-12-27 03:10:38 +01:00
PREFIX := powerpc-eabi-
OBJCOPY := $(PREFIX)objcopy
AR := $(PREFIX)ar
AS := $(PREFIX)gcc
CC := $(PREFIX)gcc
CXX := $(PREFIX)g++
STRIP := $(PREFIX)strip
ifeq ($(findstring $(PREFIX),$(LD)),)
LD := $(CC)
endif
2015-12-27 03:58:07 +01:00
EXTRA_OPTIONS =
2015-12-27 03:10:38 +01:00
ifdef VERBOSE
2015-12-27 03:58:07 +01:00
EXTRA_OPTIONS += -v
2015-12-27 03:10:38 +01:00
endif
%.o: %.c
@echo "[CC] $(notdir $<)"
2015-12-27 03:58:07 +01:00
@$(CC) $(EXTRA_OPTIONS) $(CFLAGS) $(INCLUDES) -c $< -o $@
2015-12-27 03:10:38 +01:00
%.o: %.cpp
@echo "[CXX] $(notdir $<)"
2015-12-27 03:58:07 +01:00
@$(CXX) $(EXTRA_OPTIONS) $(CXXFLAGS) $(INCLUDES) -c $< -o $@
2015-12-27 03:10:38 +01:00
%.o: %.s
@echo "[CC] $(notdir $<)"
2015-12-27 03:58:07 +01:00
@$(AS) $(EXTRA_OPTIONS) -x assembler-with-cpp $(ASFLAGS) $(INCLUDES) -c $< -o $@
2015-12-27 03:10:38 +01:00
%.o: %.S
@echo "[CC] $(notdir $<)"
2015-12-27 03:58:07 +01:00
@$(AS) $(EXTRA_OPTIONS) -x assembler-with-cpp $(ASFLAGS) $(INCLUDES) -c $< -o $@
2015-12-27 03:10:38 +01:00
%.a:
@echo "[AR] $(notdir $@)"
@$(AR) -rcs $@ $^
2016-01-04 15:35:58 +01:00
%.elf: $(OFILES)
2015-12-27 03:10:38 +01:00
@echo "[LD] $(notdir $@)"
2016-01-04 15:35:58 +01:00
@$(LD) $^ $(LIBPATHS) $(LIBS) $(LDFLAGS) -o $@