summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorscnorton <scnorton@biociphers.org>2018-01-21 14:57:28 -0500
committerscnorton <scnorton@biociphers.org>2018-01-21 14:57:28 -0500
commit2695f8d39a2ecef149ca864934ed0fd49bbd7ff6 (patch)
treecd176719e967f06ba1d3edd0c9155617cd5d749d
parent00df1bf797ec763593b392a98d58ea3576230193 (diff)
Include <string.h> in global.h and add dependency scanning
-rwxr-xr-xMakefile14
-rw-r--r--include/global.h14
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 <string.h>
#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