Fixed Makefile dirname: missing operand and implementation warnings

This commit is contained in:
AntonJ 2025-03-06 15:59:11 +02:00
parent bccacd0a21
commit c41f3b0d5f
4 changed files with 50 additions and 6 deletions

View File

@ -3,9 +3,14 @@ CC = arm-none-eabi-gcc
# The location of the C compiler # The location of the C compiler
# ARMGCC_ROOT is used by some makefiles that need to know where the compiler # ARMGCC_ROOT is used by some makefiles that need to know where the compiler
# is installed. # is installed.
ARMGCC_ROOT := ${shell dirname ${shell readlink ${shell which ${CC}}}}/.. ARMGCC_BIN := ${shell which ${CC}}
ifeq (${shell test -h ${ARMGCC_BIN} && echo "true" || echo "false"}, true)
ARMGCC_ROOT := ${shell dirname ${shell readlink ${ARMGCC_BIN}}}/..
else
ARMGCC_ROOT := ${shell dirname ${ARMGCC_BIN}}/..
endif
OBJECTS = main.o system.o startup.o OBJECTS = main.o system.o startup.o syscalls.o
NAME = lab NAME = lab
@ -40,6 +45,7 @@ LFLAGS = -Wl,-T,../config.lds \
--specs=nano.specs --specs=nano.specs
all: $(NAME).out all: $(NAME).out
@echo "SUCCESS: Compilation completed successfully."
main.o: main.c main.o: main.c
@$(CC) $(CFLAGS) -g $< -c -o $@ @$(CC) $(CFLAGS) -g $< -c -o $@
@ -50,6 +56,9 @@ system.o: ../system.c
startup.o: ../startup.c startup.o: ../startup.c
@$(CC) $(CFLAGS) $< -c -o $@ @$(CC) $(CFLAGS) $< -c -o $@
syscalls.o: ../syscalls.c
@$(CC) $(CFLAGS) $< -c -o $@
$(NAME).out: $(OBJECTS) $(NAME).out: $(OBJECTS)
@$(CC) $(OBJECTS) $(LFLAGS) -o $(NAME).out @$(CC) $(OBJECTS) $(LFLAGS) -o $(NAME).out

View File

@ -3,9 +3,14 @@ CC = arm-none-eabi-gcc
# The location of the C compiler # The location of the C compiler
# ARMGCC_ROOT is used by some makefiles that need to know where the compiler # ARMGCC_ROOT is used by some makefiles that need to know where the compiler
# is installed. # is installed.
ARMGCC_ROOT := ${shell dirname ${shell readlink ${shell which ${CC}}}}/.. ARMGCC_BIN := ${shell which ${CC}}
ifeq (${shell test -h ${ARMGCC_BIN} && echo "true" || echo "false"}, true)
ARMGCC_ROOT := ${shell dirname ${shell readlink ${ARMGCC_BIN}}}/..
else
ARMGCC_ROOT := ${shell dirname ${ARMGCC_BIN}}/..
endif
OBJECTS = main.o bump.o delay.o clock.o system.o startup.o OBJECTS = main.o bump.o delay.o clock.o system.o startup.o syscalls.o
NAME = lab NAME = lab
@ -40,6 +45,7 @@ LFLAGS = -Wl,-T,../config.lds \
--specs=nano.specs --specs=nano.specs
all: $(NAME).out all: $(NAME).out
@echo "SUCCESS: Compilation completed successfully."
main.o: main.c main.o: main.c
@$(CC) $(CFLAGS) -g $< -c -o $@ @$(CC) $(CFLAGS) -g $< -c -o $@
@ -59,6 +65,9 @@ system.o: ../system.c
startup.o: ../startup.c startup.o: ../startup.c
@$(CC) $(CFLAGS) $< -c -o $@ @$(CC) $(CFLAGS) $< -c -o $@
syscalls.o: ../syscalls.c
@$(CC) $(CFLAGS) $< -c -o $@
$(NAME).out: $(OBJECTS) $(NAME).out: $(OBJECTS)
@$(CC) $(OBJECTS) $(LFLAGS) -o $(NAME).out @$(CC) $(OBJECTS) $(LFLAGS) -o $(NAME).out

View File

@ -3,9 +3,14 @@ CC = arm-none-eabi-gcc
# The location of the C compiler # The location of the C compiler
# ARMGCC_ROOT is used by some makefiles that need to know where the compiler # ARMGCC_ROOT is used by some makefiles that need to know where the compiler
# is installed. # is installed.
ARMGCC_ROOT := ${shell dirname ${shell readlink ${shell which ${CC}}}}/.. ARMGCC_BIN := ${shell which ${CC}}
ifeq (${shell test -h ${ARMGCC_BIN} && echo "true" || echo "false"}, true)
ARMGCC_ROOT := ${shell dirname ${shell readlink ${ARMGCC_BIN}}}/..
else
ARMGCC_ROOT := ${shell dirname ${ARMGCC_BIN}}/..
endif
OBJECTS = main.o bump.o delay.o clock.o reflectance.o cpu.o system.o startup.o OBJECTS = main.o bump.o delay.o clock.o reflectance.o cpu.o system.o startup.o syscalls.o
NAME = lab NAME = lab
@ -40,6 +45,7 @@ LFLAGS = -Wl,-T,../config.lds \
--specs=nano.specs --specs=nano.specs
all: $(NAME).out all: $(NAME).out
@echo "SUCCESS: Compilation completed successfully."
main.o: main.c main.o: main.c
@$(CC) $(CFLAGS) -g $< -c -o $@ @$(CC) $(CFLAGS) -g $< -c -o $@
@ -65,6 +71,9 @@ system.o: ../system.c
startup.o: ../startup.c startup.o: ../startup.c
@$(CC) $(CFLAGS) $< -c -o $@ @$(CC) $(CFLAGS) $< -c -o $@
syscalls.o: ../syscalls.c
@$(CC) $(CFLAGS) $< -c -o $@
$(NAME).out: $(OBJECTS) $(NAME).out: $(OBJECTS)
@$(CC) $(OBJECTS) $(LFLAGS) -o $(NAME).out @$(CC) $(OBJECTS) $(LFLAGS) -o $(NAME).out

17
syscalls.c Normal file
View File

@ -0,0 +1,17 @@
// Minimal implementations to supress the warnings
int _close(int file) {
return -1;
}
int _lseek(int file, int ptr, int dir) {
return 0;
}
int _read(int file, char *ptr, int len) {
return 0;
}
int _write(int file, char *ptr, int len) {
return len;
}