wut/rules/base.mk

55 lines
1.2 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
export PORTLIBS := $(DEVKITPRO)/portlibs/ppc
export PATH := $(DEVKITPPC)/bin:$(PORTLIBS)/bin:$(PATH)
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 $@ $^
%.elf:
@echo "[LD] $(notdir $@)"
@echo "[LD] $(LIBPATHS)"
@echo "[LD] $(LDFLAGS)"
@$(LD) -v $^ $(LIBPATHS) $(LIBS) $(LDFLAGS) -o $@