-
-
Notifications
You must be signed in to change notification settings - Fork 45
/
Makefile.switch
60 lines (45 loc) · 1.74 KB
/
Makefile.switch
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
ifeq ($(strip $(DEVKITPRO)),)
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>/devkitpro")
endif
include $(DEVKITPRO)/libnx/switch_rules
NAME := noods
BUILD := build-switch
SRCS := src src/common src/console
DATA := src/console/images
LIBS := -lglad -lEGL -lglapi -ldrm_nouveau -lnx
INCS := $(PORTLIBS) $(LIBNX)
APP_TITLE := NooDS
APP_AUTHOR := Hydr8gon
APP_VERSION := 0.1
APP_ICON := ../icon/icon-switch.jpg
ARCH := -march=armv8-a+crc+crypto -mtune=cortex-a57 -mtp=soft -fPIE
CXXFLAGS := -Ofast -flto -std=c++11 -ffunction-sections $(ARCH) $(INCLUDE) -D__SWITCH__ -DNO_FDOPEN #-DDEBUG
LDFLAGS = -specs=$(DEVKITPRO)/libnx/switch.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
ifneq ($(BUILD),$(notdir $(CURDIR)))
export LD := $(CXX)
export OUTPUT := $(CURDIR)/$(NAME)
export DEPSDIR := $(CURDIR)/$(BUILD)
export LIBPATHS := $(foreach dir,$(INCS),-L$(dir)/lib)
export VPATH := $(foreach dir,$(SRCS),$(CURDIR)/$(dir)) $(foreach dir,$(DATA),$(CURDIR)/$(dir))
export INCLUDE := $(foreach dir,$(SRCS),-I$(CURDIR)/$(dir)) $(foreach dir,$(INCS),-I$(dir)/include)
export NROFLAGS += --icon=$(APP_ICON) --nacp=$(CURDIR)/$(NAME).nacp
CPPFILES := $(foreach dir,$(SRCS),$(notdir $(wildcard $(dir)/*.cpp)))
BMPFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.bmp)))
export OFILES := $(CPPFILES:.cpp=.o) $(BMPFILES:.bmp=.o)
.PHONY: $(BUILD)
all: $(BUILD)
$(BUILD):
mkdir -p $@
$(MAKE) -C $(BUILD) -f $(CURDIR)/Makefile.switch
clean:
rm -rf $(BUILD) $(NAME).nro $(NAME).nacp $(NAME).elf
else
all: $(OUTPUT).nro
$(OUTPUT).nro: $(OUTPUT).elf $(OUTPUT).nacp
$(OUTPUT).elf: $(OFILES)
%.o: %.bmp
@echo $(notdir $<)
@cd ..; $(PREFIX)ld -r -b binary -o $(BUILD)/$@ src/console/images/$*.bmp
DEPENDS := $(OFILES:.o=.d)
-include $(DEPENDS)
endif