From 00df1bf797ec763593b392a98d58ea3576230193 Mon Sep 17 00:00:00 2001 From: scnorton Date: Sun, 21 Jan 2018 12:51:52 -0500 Subject: Use standard flags to link libc, libgcc --- Makefile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 6d5d120..e568dcf 100755 --- a/Makefile +++ b/Makefile @@ -11,8 +11,7 @@ LD := $(DEVKITARM)/bin/arm-none-eabi-ld OBJCOPY := $(DEVKITARM)/bin/arm-none-eabi-objcopy -LIBGCC := tools/agbcc/lib/libgcc.a -LIBC := tools/agbcc/lib/libc.a +LIB := -L tools/agbcc/lib -lc -lgcc MD5 := md5sum -c @@ -93,7 +92,7 @@ ld_script.ld: ld_script.txt sym_ewram.ld sym_ewram2.ld sym_iwram.ld sed -f ld_script.sed ld_script.txt >ld_script.ld pmd_red.elf: ld_script.ld $(OBJS) $(LIBC) - $(LD) -T ld_script.ld -Map pmd_red.map -o $@ $(OBJS) $(LIBC) $(LIBGCC) + $(LD) -T ld_script.ld -Map pmd_red.map -o $@ $(OBJS) $(LIB) pmd_red.gba: pmd_red.elf $(OBJCOPY) -O binary --gap-fill 0xFF --pad-to 0xA000000 $< $@ -- cgit v1.2.3 From 2695f8d39a2ecef149ca864934ed0fd49bbd7ff6 Mon Sep 17 00:00:00 2001 From: scnorton Date: Sun, 21 Jan 2018 14:57:28 -0500 Subject: Include in global.h and add dependency scanning --- Makefile | 14 +++++++++++--- include/global.h | 14 ++------------ 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index e568dcf..c91a4e2 100755 --- a/Makefile +++ b/Makefile @@ -41,6 +41,14 @@ ASM_OBJS := $(ASM_SRCS:%.s=%.o) DATA_ASM_SRCS := $(wildcard data/*.s) DATA_ASM_OBJS := $(DATA_ASM_SRCS:%.s=%.o) +# Disable dependency scanning when NODEP is used for quick building +ifeq ($(NODEP),) + src/%.o: C_DEP = $(shell $(SCANINC) -I include src/$(*F).c) + asm/%.o: ASM_DEP = $(shell $(SCANINC) asm/$(*F).s) + data/%.o: ASM_DEP = $(shell $(SCANINC) data/$(*F).s) +endif + + OBJS := $(C_OBJS) $(ASM_OBJS) $(DATA_ASM_OBJS) all: pmd_red.gba @@ -67,16 +75,16 @@ src/agb_flash.o: CFLAGS := -O -mthumb-interwork src/agb_flash_1m.o: CFLAGS := -O -mthumb-interwork src/agb_flash_mx.o: CFLAGS := -O -mthumb-interwork -$(C_OBJS): %.o : %.c +$(C_OBJS): %.o : %.c $$(C_DEP) @$(CPP) $(CPPFLAGS) $< -o $*.i @$(CC1) $(CFLAGS) $*.i -o $*.s @printf ".text\n\t.align\t2, 0\n" >> $*.s $(AS) $(ASFLAGS) -o $@ $*.s -$(ASM_OBJS): %.o: %.s +$(ASM_OBJS): %.o: %.s $$(ASM_DEP) $(AS) $(ASFLAGS) -o $@ $< -$(DATA_ASM_OBJS): %.o: %.s +$(DATA_ASM_OBJS): %.o: %.s $$(ASM_DEP) $(AS) $(ASFLAGS) -o $@ $< sym_ewram.ld: sym_ewram.txt diff --git a/include/global.h b/include/global.h index 75592d5..66c1b6d 100644 --- a/include/global.h +++ b/include/global.h @@ -1,10 +1,11 @@ #ifndef GUARD_GLOBAL_H #define GUARD_GLOBAL_H +#include #include "gba/gba.h" // IDE support -#ifdef __APPLE__ +#if defined(__APPLE__) || defined(__CYGWIN__) #define _(x) x #define __(x) x #define INCBIN_U8 {0} @@ -13,9 +14,6 @@ #define INCBIN_S8 {0} #define INCBIN_S16 {0} #define INCBIN_S32 {0} -void * memcpy (void *, const void *, size_t); -void * memset (void *, int, size_t); -int strcmp (const char *, const char *); #endif // Prevent cross-jump optimization. @@ -26,14 +24,6 @@ int strcmp (const char *, const char *); #define asm_unified(x) asm(".syntax unified\n" x "\n.syntax divided\n") -#define nonmatching(fndec, x) {\ -__attribute__((naked))\ -fndec\ -{\ - asm_unified(x);\ -}\ -} - #define ARRAY_COUNT(array) (sizeof(array) / sizeof((array)[0])) #endif // GUARD_GLOBAL_H -- cgit v1.2.3 From 0429b2e5bb2a2c4467518bf921bd900927e84205 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 21 Jan 2018 20:26:38 -0500 Subject: Fix Windows --- Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index c91a4e2..b2f476a 100755 --- a/Makefile +++ b/Makefile @@ -11,7 +11,11 @@ LD := $(DEVKITARM)/bin/arm-none-eabi-ld OBJCOPY := $(DEVKITARM)/bin/arm-none-eabi-objcopy -LIB := -L tools/agbcc/lib -lc -lgcc +ifeq ($(OS),Windows_NT) + LIB := tools/agbcc/lib/libc.a tools/agbcc/lib/libgcc.a +else + LIB := -L tools/agbcc/lib -lc -lgcc +endif MD5 := md5sum -c -- cgit v1.2.3