# Extra-verbose errors!
#CFLAGS += -Wall -Wextra -Wwrite-strings -Wshadow -Wswitch-default -Wswitch-enum -Wstrict-overflow=5 -Wfloat-equal -Wundef -Wmissing-declarations -Wlogical-op -Wformat=2 -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wsync-nand -Wunused -Wstrict-overflow=5 -Wfloat-equal -Wundef -Wno-endif-labels -Wshadow -Wunsafe-loop-optimizations -Wbad-function-cast -Wc++-compat -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Wlogical-op -Waggregate-return -Wstrict-prototypes -Wold-style-definition -Wmissing-declarations -Wnormalized=nfc -Wpacked -Wpadded -Wredundant-decls -Wnested-externs -Winline -Winvalid-pch -Wdisabled-optimization -Woverlength-strings
+CRTBEGIN = $(shell $(CC) $(CFLAGS) -print-file-name=crtbegin.o)
+CRTEND = $(shell $(CC) $(CFLAGS) -print-file-name=crtend.o)
+
DIR = Bin
$(_BIN): $(OUTPUTDIR)Libs/acess.ld $(OUTPUTDIR)Libs/crt0.o $(_LIBS) $(OBJ)
@mkdir -p $(dir $(_BIN))
@echo [LD] -o $@
- $V$(LD) -g $(LDFLAGS) -o $@ $(OBJ) $(LIBGCC_PATH)
+ $V$(LD) -g $(LDFLAGS) -o $@ $(CRTBEGIN) $(OBJ) $(LIBGCC_PATH) $(CRTEND)
$V$(DISASM) $(_BIN) > $(_OBJPREFIX)$(BIN).dsm
$(OBJ): $(_OBJPREFIX)%.o: %.c
else
LDFLAGS += -Wl,-init,SoMain
CFLAGS += -fPIC
+ CXXFLAGS += -fPIC
endif
else ifneq ($(HOST_ARCH),)
ASFLAGS += -D ARCHDIR=$(ARCHDIR) -D __ASSEMBLER__=1
else
LDFLAGS += -Wl,-init,SoMain
CFLAGS += -fPIC
+ CXXFLAGS += -fPIC
endif
else
CPPFLAGS := -ffreestanding
CFLAGS := -fno-stack-protector -fPIC
+ CXXFLAGS := -fno-stack-protector -fPIC
LDFLAGS := -I/Acess/Libs/ld-acess.so -lld-acess `$(CC) -print-libgcc-file-name`
endif
LDFLAGS += -g -nostdlib -shared -eSoMain -x --no-undefined -L$(OUTPUTDIR)Libs/