common: add header dependencies
This commit is contained in:
parent
0c7c2e663a
commit
f6c9380ece
1
.gitignore
vendored
1
.gitignore
vendored
@ -6,3 +6,4 @@ segasmp/lib/sys_init.o
|
|||||||
*.bin
|
*.bin
|
||||||
*.gch
|
*.gch
|
||||||
*.out
|
*.out
|
||||||
|
*.d
|
16
common.mk
16
common.mk
@ -1,6 +1,7 @@
|
|||||||
LIB ?= .
|
LIB ?= .
|
||||||
OPT ?= -Og
|
OPT ?= -Og
|
||||||
DEBUG ?= -g -gdwarf-4
|
DEBUG ?= -g -gdwarf-4
|
||||||
|
GENERATED ?=
|
||||||
|
|
||||||
AARCH = --isa=sh2 --big
|
AARCH = --isa=sh2 --big
|
||||||
AFLAGS = --fatal-warnings
|
AFLAGS = --fatal-warnings
|
||||||
@ -8,6 +9,7 @@ AFLAGS = --fatal-warnings
|
|||||||
CARCH = -m2 -mb
|
CARCH = -m2 -mb
|
||||||
CFLAGS += -falign-functions=4 -ffunction-sections -fdata-sections -fshort-enums -ffreestanding -nostdlib
|
CFLAGS += -falign-functions=4 -ffunction-sections -fdata-sections -fshort-enums -ffreestanding -nostdlib
|
||||||
CFLAGS += -Wall -Werror -Wfatal-errors -Wno-error=unused-variable
|
CFLAGS += -Wall -Werror -Wfatal-errors -Wno-error=unused-variable
|
||||||
|
DEPFLAGS = -MMD -E
|
||||||
LDFLAGS = --gc-sections --print-gc-sections --no-warn-rwx-segment --print-memory-usage --entry=_start --orphan-handling=error
|
LDFLAGS = --gc-sections --print-gc-sections --no-warn-rwx-segment --print-memory-usage --entry=_start --orphan-handling=error
|
||||||
CXXFLAGS = -std=c++20 -fno-exceptions -fno-non-call-exceptions -fno-rtti -fno-threadsafe-statics
|
CXXFLAGS = -std=c++20 -fno-exceptions -fno-non-call-exceptions -fno-rtti -fno-threadsafe-statics
|
||||||
|
|
||||||
@ -31,7 +33,7 @@ endef
|
|||||||
as_obj_binary = _binary_$(subst .,_,$(subst /,_,$(basename $(1))))
|
as_obj_binary = _binary_$(subst .,_,$(subst /,_,$(basename $(1))))
|
||||||
|
|
||||||
define BUILD_BINARY_H
|
define BUILD_BINARY_H
|
||||||
@echo $@
|
@echo gen $@
|
||||||
@echo '#pragma once' > $@
|
@echo '#pragma once' > $@
|
||||||
@echo '#include <stdint.h>' >> $@
|
@echo '#include <stdint.h>' >> $@
|
||||||
@echo 'extern uint32_t $(call as_obj_binary,$@)_start __asm("$(call as_obj_binary,$@)_start");' >> $@
|
@echo 'extern uint32_t $(call as_obj_binary,$@)_start __asm("$(call as_obj_binary,$@)_start");' >> $@
|
||||||
@ -45,10 +47,16 @@ endef
|
|||||||
%.o: %.S
|
%.o: %.S
|
||||||
$(CC) $(CARCH) $(CFLAGS) $(OPT) $(DEBUG) -c $< -o $@
|
$(CC) $(CARCH) $(CFLAGS) $(OPT) $(DEBUG) -c $< -o $@
|
||||||
|
|
||||||
%.o: %.c
|
%.d: %.c $(GENERATED)
|
||||||
|
$(CC) $(CARCH) $(CFLAGS) $(OPT) $(DEBUG) $(DEPFLAGS) -c $< -MF $@ -o /dev/null
|
||||||
|
|
||||||
|
%.o: %.c %.d
|
||||||
$(CC) $(CARCH) $(CFLAGS) $(OPT) $(DEBUG) -c $< -o $@
|
$(CC) $(CARCH) $(CFLAGS) $(OPT) $(DEBUG) -c $< -o $@
|
||||||
|
|
||||||
%.o: %.cpp
|
%.d: %.cpp $(GENERATED)
|
||||||
|
$(CXX) $(CARCH) $(CFLAGS) $(CXXFLAGS) $(OPT) $(DEBUG) $(DEPFLAGS) -c $< -MF $@ -o /dev/null
|
||||||
|
|
||||||
|
%.o: %.cpp %.d
|
||||||
$(CXX) $(CARCH) $(CFLAGS) $(CXXFLAGS) $(OPT) $(DEBUG) -c $< -o $@
|
$(CXX) $(CARCH) $(CFLAGS) $(CXXFLAGS) $(OPT) $(DEBUG) -c $< -o $@
|
||||||
|
|
||||||
%.elf: $(LIB)/start.o
|
%.elf: $(LIB)/start.o
|
||||||
@ -127,7 +135,7 @@ sys_ip.elf: $(SYS_IP_OBJ)
|
|||||||
@echo " INDEX 01 00:00:00" >> $@
|
@echo " INDEX 01 00:00:00" >> $@
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.iso *.o *.bin *.elf *.cue
|
rm -f *.iso *.o *.d *.bin *.elf *.cue
|
||||||
|
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
.INTERMEDIATE:
|
.INTERMEDIATE:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user