ARCHDIR := native
LD ?= $(CC) -print-prog-name=ld
+AS = $(CC) -c
+ASSUFFIX = S
OBJDUMP := objdump -S
# Include Usermode Makefile.cfg
include $(dir $(lastword $(MAKEFILE_LIST)))../Makefile.cfg
+ifeq ($(ARCHDIR),native)
ASFLAGS = -felf
-CPPFLAGS = -ffreestanding -I$(ACESSUSERDIR)/include/ -DARCHDIR_is_$(ARCHDIR)
-CPPFLAGS += $(addprefix -I,$(wildcard $(ACESSUSERDIR)Libraries/*/include_exp/))
-CFLAGS = -fno-stack-protector $(CPPFLAGS)
+CPPFLAGS = -Wall
+CFLAGS = $(CPPFLAGS)
+LDFLAGS = -L $(OUTPUTDIR)Libs -lacess-native
+LIBGCC_PATH = $(ACESSDIR)/AcessNative/symbol_renames.ld
+else
+ASFLAGS = -felf
+CPPFLAGS = -ffreestanding
+CFLAGS = -fno-stack-protector -fno-builtin $(CPPFLAGS)
LDFLAGS = -T $(OUTPUTDIR)Libs/acess.ld -rpath-link $(OUTPUTDIR)Libs -L $(OUTPUTDIR)Libs -I /Acess/Libs/ld-acess.so -lld-acess -lc $(OUTPUTDIR)Libs/crtbegin.o $(OUTPUTDIR)Libs/crtend.o -lposix
LIBGCC_PATH = $(shell $(CC) -print-libgcc-file-name)
+endif
+
+CPPFLAGS += $(addprefix -I,$(wildcard $(ACESSUSERDIR)Libraries/*/include_exp/))
+CPPFLAGS += -I$(ACESSUSERDIR)/include/ -DARCHDIR_is_$(ARCHDIR)
+
# 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
+#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
DIR = Bin
# - Application Template Makefile
#
-CFLAGS += -Wall -Werror -fno-builtin -fno-stack-protector -g
+CFLAGS += -g
LDFLAGS += -g
_BIN := $(OUTPUTDIR)$(DIR)/$(BIN)
_LIBS := $(filter -l%,$(LDFLAGS))
_LIBS := $(patsubst -l%,$(OUTPUTDIR)Libs/lib%.so,$(_LIBS))
+ifeq ($(VERBOSE),)
+V := @
+else
+V :=
+endif
+
OBJ := $(addprefix $(_OBJPREFIX),$(OBJ))
DEPFILES := $(OBJ:%.o=%.dep)
$(_BIN): $(OUTPUTDIR)Libs/acess.ld $(OUTPUTDIR)Libs/crt0.o $(_LIBS) $(OBJ)
@mkdir -p $(dir $(_BIN))
@echo [LD] -o $@
-ifneq ($(_DBGMAKEFILE),)
- $(LD) -g $(LDFLAGS) -o $@ $(OBJ) -Map $(_OBJPREFIX)Map.txt $(LIBGCC_PATH)
-else
- @$(LD) -g $(LDFLAGS) -o $@ $(OBJ) -Map $(_OBJPREFIX)Map.txt $(LIBGCC_PATH)
-endif
- @$(DISASM) $(_BIN) > $(_OBJPREFIX)$(BIN).dsm
+#ifeq ($(ARCHDIR),native)
+#else
+ $V$(LD) -g $(LDFLAGS) -o $@ $(OBJ) -Map $(_OBJPREFIX)Map.txt $(LIBGCC_PATH)
+#endif
+ $V$(DISASM) $(_BIN) > $(_OBJPREFIX)$(BIN).dsm
$(OBJ): $(_OBJPREFIX)%.o: %.c
@echo [CC] -o $@
ifneq ($(_OBJPREFIX),)
@mkdir -p $(dir $@)
endif
- @$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
- @$(CC) -M -MP -MT $@ $(CPPFLAGS) $< -o $(_OBJPREFIX)$*.dep
+ $V$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
+ $V$(CC) -M -MP -MT $@ $(CPPFLAGS) $< -o $(_OBJPREFIX)$*.dep
$(OUTPUTDIR)Libs/libld-acess.so:
@make -C $(ACESSDIR)/Usermode/Libraries/ld-acess.so_src/
@make -C $(ACESSDIR)/Usermode/Libraries/$*_src/
-include $(DEPFILES)
+
+# vim: ft=make
line_num ++;
int rv;
- if( (rv = fscanf(fp, "%64s%*[ \t]", &cmdbuf)) != 1 ) {
+ if( (rv = fscanf(fp, "%64s%*[ \t]", cmdbuf)) != 1 ) {
_SysDebug("fscanf rv %i != exp 1", rv);
break;
}
// stty <devpath> [78][NOE][012][bB]<baud> <command...>
char path_seg[32+1];
char modespec[4+6+1];
- if( fscanf(fp, "%32s %6s ", &path_seg, &modespec) != 2 ) {
+ if( fscanf(fp, "%32s %6s ", path_seg, modespec) != 2 ) {
goto lineError;
}
char **command = ReadCommand(fp);
UTESTS := $(patsubst TEST_%.c,%,$(wildcard TEST_*.c))
DEPFILES := $(addsuffix .dep,$(OBJ))
+ifeq ($(VERBOSE),1)
+V :=
+else
+V := @
+endif
+
.PHONY: all clean install postbuild
all: _libs $(_BIN) $(_XBIN)
install: all
@echo [xCP] $(DISTROOT)/Libs/$(BIN)
- @$(xMKDIR) $(DISTROOT)/Libs; true
- @$(STRIP) $(_BIN) -o $(_BIN)_
- @$(xCP) $(_BIN)_ $(DISTROOT)/Libs/$(BIN)
- @$(RM) $(_BIN)_
+ $V$(xMKDIR) $(DISTROOT)/Libs; true
+ $V$(STRIP) $(_BIN) -o $(_BIN)_
+ $V$(xCP) $(_BIN)_ $(DISTROOT)/Libs/$(BIN)
+ $V$(RM) $(_BIN)_
ifneq ($(_XBIN),)
$(xCP) $(_XBIN) $(DISTROOT)/Libs/
endif
$(_BIN): $(OBJ) $(_LIBS)
@mkdir -p $(dir $(_BIN))
@echo [LD] -o $(BIN) $(OBJ)
- @$(LD) $(LDFLAGS) -o $(_BIN) $(OBJ) $(shell $(CC) -print-libgcc-file-name)
- @$(DISASM) -D -S $(_BIN) > $(_OBJPREFIX)$(BIN).dsm
+ $V$(LD) $(LDFLAGS) -o $(_BIN) $(OBJ) $(shell $(CC) -print-libgcc-file-name)
+ $V$(DISASM) -D -S $(_BIN) > $(_OBJPREFIX)$(BIN).dsm
$(_OBJPREFIX)%.o: %.c
@echo [CC] -o $@
@mkdir -p $(dir $@)
- @$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
$(_OBJPREFIX)%.ao: %.$(ASSUFFIX)
@echo [AS] -o $@
@mkdir -p $(dir $@)
- @$(AS) $(ASFLAGS) -o $@ $<
+ $V$(AS) $(ASFLAGS) -o $@ $<
ifeq ($(ASSUFFIX),S)
else
endif
#$(OUTPUTDIR)Libs/libld-acess.so: