diff --git a/lab1/Makefile b/lab1/Makefile index 9385d8e..4b14d1a 100644 --- a/lab1/Makefile +++ b/lab1/Makefile @@ -10,6 +10,9 @@ else ARMGCC_ROOT := ${shell dirname ${ARMGCC_BIN}}/.. endif +# Search for source files that are not in this directory +VPATH = ../common/ + OBJECTS = main.o system.o startup.o syscalls.o NAME = lab @@ -47,7 +50,7 @@ LFLAGS = -Wl,-T,../config.lds \ all: $(NAME).out @echo "SUCCESS: Compilation completed successfully." -main.o: main.c +%.o: %.c @$(CC) $(CFLAGS) -g $< -c -o $@ system.o: ../system.c diff --git a/lab2/Makefile b/lab2/Makefile index 1a68222..26f9be7 100644 --- a/lab2/Makefile +++ b/lab2/Makefile @@ -10,6 +10,9 @@ else ARMGCC_ROOT := ${shell dirname ${ARMGCC_BIN}}/.. endif +# Search for source files that are not in this directory +VPATH = ../common/ + OBJECTS = main.o bump.o delay.o clock.o system.o startup.o syscalls.o NAME = lab @@ -47,13 +50,7 @@ LFLAGS = -Wl,-T,../config.lds \ all: $(NAME).out @echo "SUCCESS: Compilation completed successfully." -main.o: main.c - @$(CC) $(CFLAGS) -g $< -c -o $@ - -bump.o: ../common/bump.c - @$(CC) $(CFLAGS) -g $< -c -o $@ - -delay.o: ../common/delay.c +%.o: %.c @$(CC) $(CFLAGS) -g $< -c -o $@ clock.o: ../common/clock.c diff --git a/lab3/Makefile b/lab3/Makefile index 7920501..7bc71d4 100644 --- a/lab3/Makefile +++ b/lab3/Makefile @@ -10,7 +10,10 @@ 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 syscalls.o +# Search for source files that are not in this directory +VPATH = ../common/ + +OBJECTS = main.o bump.o delay.o reflectance.o clock.o cpu.o system.o startup.o syscalls.o NAME = lab @@ -47,21 +50,12 @@ LFLAGS = -Wl,-T,../config.lds \ all: $(NAME).out @echo "SUCCESS: Compilation completed successfully." -main.o: main.c - @$(CC) $(CFLAGS) -g $< -c -o $@ - -bump.o: ../common/bump.c - @$(CC) $(CFLAGS) -g $< -c -o $@ - -delay.o: ../common/delay.c +%.o: %.c @$(CC) $(CFLAGS) -g $< -c -o $@ clock.o: ../common/clock.c @$(CC) $(CFLAGS) $< -c -o $@ -reflectance.o: ../common/reflectance.c - @$(CC) $(CFLAGS) -g $< -c -o $@ - cpu.o: ../common/cpu.c @$(CC) $(CFLAGS) $< -c -o $@