mirror of
https://github.com/wiiu-env/wut.git
synced 2024-12-05 03:04:16 +01:00
Add helloworld sample.
This commit is contained in:
parent
756bc99c39
commit
21d044710f
62
samples/helloworld/Makefile
Normal file
62
samples/helloworld/Makefile
Normal file
@ -0,0 +1,62 @@
|
||||
.SUFFIXES:
|
||||
|
||||
ifeq ($(strip $(WUT_ROOT)),)
|
||||
$(error "Please ensure WUT_ROOT is in your environment.")
|
||||
endif
|
||||
|
||||
include $(WUT_ROOT)/rules/rpl.mk
|
||||
|
||||
TARGET := $(notdir $(CURDIR))
|
||||
BUILD := build
|
||||
SOURCE := src
|
||||
INCLUDE := include
|
||||
DATA := data
|
||||
LIBS := -lcoreinit
|
||||
|
||||
CFLAGS += -O2 -Wall -std=c11
|
||||
CXXFLAGS += -O2 -Wall
|
||||
LDFLAGS += -lcoreinit -lgx2
|
||||
|
||||
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
||||
|
||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||
export VPATH := $(foreach dir,$(SOURCE),$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
||||
export BUILDDIR := $(CURDIR)/$(BUILD)
|
||||
export DEPSDIR := $(BUILDDIR)
|
||||
|
||||
CFILES := $(foreach dir,$(SOURCE),$(notdir $(wildcard $(dir)/*.c)))
|
||||
CXXFILES := $(foreach dir,$(SOURCE),$(notdir $(wildcard $(dir)/*.cpp)))
|
||||
SFILES := $(foreach dir,$(SOURCE),$(notdir $(wildcard $(dir)/*.S)))
|
||||
|
||||
ifeq ($(strip $(CXXFILES)),)
|
||||
export LD := $(CC)
|
||||
else
|
||||
export LD := $(CXX)
|
||||
endif
|
||||
|
||||
export OFILES := $(CFILES:.c=.o) \
|
||||
$(CXXFILES:.cpp=.o) \
|
||||
$(SFILES:.S=.o)
|
||||
export INCLUDES := $(foreach dir,$(INCLUDE),-I$(CURDIR)/$(dir)) \
|
||||
-I$(CURDIR)/$(BUILD)
|
||||
|
||||
.PHONY: $(BUILD) clean pkg run
|
||||
|
||||
$(BUILD):
|
||||
@[ -d $@ ] || mkdir -p $@
|
||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||
|
||||
clean:
|
||||
@echo "[RM] $(notdir $(OUTPUT))"
|
||||
@rm -rf $(BUILD) $(OUTPUT).elf $(OUTPUT).rpx $(OUTPUT).a
|
||||
|
||||
else
|
||||
|
||||
DEPENDS := $(OFILES:.o=.d)
|
||||
|
||||
$(OUTPUT).elf: $(OFILES)
|
||||
|
||||
-include $(DEPENDS)
|
||||
|
||||
endif
|
9
samples/helloworld/src/main.c
Normal file
9
samples/helloworld/src/main.c
Normal file
@ -0,0 +1,9 @@
|
||||
#include <coreinit_debug.h>
|
||||
#include <gx2_init.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
GX2Init();
|
||||
OSFatal("my first rpx");
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user