Skip to content

Commit 0c9c332

Browse files
committed
add build system base files
1 parent c816874 commit 0c9c332

3 files changed

Lines changed: 82 additions & 0 deletions

File tree

dka64/rules/base_rules

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
include $(DEVKITPRO)/devkitA64/base_tools
2+
3+
#---------------------------------------------------------------------------------
4+
%.a:
5+
#---------------------------------------------------------------------------------
6+
@echo $(notdir $@)
7+
@rm -f $@
8+
$(AR) -rc $@ $^
9+
10+
11+
#---------------------------------------------------------------------------------
12+
%.o: %.cpp
13+
@echo $(notdir $<)
14+
$(CXX) -MMD -MP -MF $(DEPSDIR)/$*.d $(CXXFLAGS) -c $< -o $@ $(ERROR_FILTER)
15+
16+
#---------------------------------------------------------------------------------
17+
%.o: %.c
18+
@echo $(notdir $<)
19+
$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d $(CFLAGS) -c $< -o $@ $(ERROR_FILTER)
20+
21+
#---------------------------------------------------------------------------------
22+
%.o: %.s
23+
@echo $(notdir $<)
24+
$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d -x assembler-with-cpp $(ASFLAGS) -c $< -o $@ $(ERROR_FILTER)
25+
26+
#---------------------------------------------------------------------------------
27+
%.o: %.S
28+
@echo $(notdir $<)
29+
$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d -x assembler-with-cpp $(ASFLAGS) -c $< -o $@ $(ERROR_FILTER)
30+
31+
#---------------------------------------------------------------------------------
32+
# canned command sequence for binary data
33+
#---------------------------------------------------------------------------------
34+
define bin2o
35+
bin2s $< | $(AS) -o $(@)
36+
echo "extern const u8" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end[];" > `(echo $(<F) | tr . _)`.h
37+
echo "extern const u8" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"[];" >> `(echo $(<F) | tr . _)`.h
38+
echo "extern const u32" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size";" >> `(echo $(<F) | tr . _)`.h
39+
endef
40+

dka64/rules/base_tools

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#---------------------------------------------------------------------------------
2+
# make sure we have bash on OSX
3+
#---------------------------------------------------------------------------------
4+
UNAME_S := $(shell uname -s)
5+
UNAME_R := $(shell uname -r)
6+
7+
ifneq (,$(findstring Darwin,$(UNAME_S)))
8+
export SHELL=/bin/bash
9+
endif
10+
#---------------------------------------------------------------------------------
11+
# path to tools
12+
#---------------------------------------------------------------------------------
13+
export PATH := $(DEVKITPRO)/devkitA64/bin:$(PATH)
14+
15+
#---------------------------------------------------------------------------------
16+
# add portlibs path
17+
#---------------------------------------------------------------------------------
18+
export PORTLIBS_PATH := $(DEVKITPRO)/portlibs
19+
20+
#---------------------------------------------------------------------------------
21+
# the prefix on the compiler executables
22+
#---------------------------------------------------------------------------------
23+
PREFIX := aarch64-none-elf-
24+
25+
export CC := $(PREFIX)gcc
26+
export CXX := $(PREFIX)g++
27+
export AS := $(PREFIX)as
28+
export AR := $(PREFIX)gcc-ar
29+
export OBJCOPY := $(PREFIX)objcopy
30+
export STRIP := $(PREFIX)strip
31+
export NM := $(PREFIX)gcc-nm
32+
export RANLIB := $(PREFIX)gcc-ranlib
33+
34+
ISVC=$(or $(VCBUILDHELPER_COMMAND),$(MSBUILDEXTENSIONSPATH32),$(MSBUILDEXTENSIONSPATH))
35+
36+
ifneq (,$(ISVC))
37+
ERROR_FILTER := 2>&1 | sed -e 's/\(.[a-zA-Z]\+\):\([0-9]\+\):/\1(\2):/g'
38+
endif

dka64/scripts/build-gcc.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,3 +172,7 @@ then
172172
touch installed-gdb
173173
fi
174174

175+
#---------------------------------------------------------------------------------
176+
# copy base rulesets
177+
#---------------------------------------------------------------------------------
178+
cp -v $BUILDSCRIPTDIR/dka64/rules/* $prefix

0 commit comments

Comments
 (0)