优化makefile (#352)

This commit is contained in:
YJwu2023 2023-08-31 17:54:49 +08:00 committed by GitHub
parent 2dd9f0c750
commit c757940bd6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 71 additions and 70 deletions

View File

@ -44,11 +44,8 @@ all: kernel
@dbg='debug';for x in $$dbg; do \ @dbg='debug';for x in $$dbg; do \
cd $$x;\ cd $$x;\
$(MAKE) generate_kallsyms kernel_root_path="$(shell pwd)";\ $(MAKE) generate_kallsyms kernel_root_path="$(shell pwd)"||exit 1;\
cd ..;\ cd ..;\
if [ "$$?" != "0" ]; then\
exit $$?;\
fi;\
done done

View File

@ -1,14 +1,10 @@
SRC = $(wildcard *.c)
OBJ = $(SRC:.c=.o)
CFLAGS += -I . CFLAGS += -I .
all: fabs.o round.o pow.o .PHONY: all
fabs.o: fabs.c all: $(OBJ)
$(CC) $(CFLAGS) -c fabs.c -o fabs.o
round.o: round.c %.o: %.c
$(CC) $(CFLAGS) -c round.c -o round.o $(CC) $(CFLAGS) -c $< -o $@
pow.o: pow.c
$(CC) $(CFLAGS) -c pow.c -o pow.o

View File

@ -1,8 +1,10 @@
SRC = $(wildcard *.c)
all: acpi.o OBJ = $(SRC:.c=.o)
CFLAGS += -I . CFLAGS += -I .
.PHONY: all
acpi.o: acpi.c all: $(OBJ)
$(CC) $(CFLAGS) -c acpi.c -o acpi.o
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@

View File

@ -1,7 +1,10 @@
SRC = $(wildcard *.c)
all: ata.o OBJ = $(SRC:.c=.o)
CFLAGS += -I . CFLAGS += -I .
ata.o: ata.c .PHONY: all
$(CC) $(CFLAGS) -c ata.c -o ata.o
all: $(OBJ)
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@

View File

@ -1,8 +1,10 @@
SRC = $(wildcard *.c)
all: ps2_keyboard.o OBJ = $(SRC:.c=.o)
CFLAGS += -I . CFLAGS += -I .
.PHONY: all
ps2_keyboard.o: ps2_keyboard.c all: $(OBJ)
$(CC) $(CFLAGS) -c ps2_keyboard.c -o ps2_keyboard.o
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@

View File

@ -1,8 +1,10 @@
SRC = $(wildcard *.c)
all: ps2_mouse.o OBJ = $(SRC:.c=.o)
CFLAGS += -I . CFLAGS += -I .
.PHONY: all
ps2_mouse.o: ps2_mouse.c all: $(OBJ)
$(CC) $(CFLAGS) -c ps2_mouse.c -o ps2_mouse.o
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@

View File

@ -1,7 +1,10 @@
SRC = $(wildcard *.c)
all: multiboot2.o OBJ = $(SRC:.c=.o)
CFLAGS += -I . CFLAGS += -I .
multiboot2.o: multiboot2.c .PHONY: all
$(CC) $(CFLAGS) -c multiboot2.c -o multiboot2.o
all: $(OBJ)
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@

View File

@ -1,9 +1,11 @@
SRC = $(wildcard *.c)
all: pci_irq.o OBJ = $(SRC:.c=.o)
CFLAGS += -I . CFLAGS += -I .
.PHONY: all
pci_irq.o: pci_irq.c all: $(OBJ)
$(CC) $(CFLAGS) -c pci_irq.c -o pci_irq.o
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@

View File

@ -1,8 +1,10 @@
SRC = $(wildcard *.c)
all: video.o OBJ = $(SRC:.c=.o)
CFLAGS += -I . CFLAGS += -I .
.PHONY: all
video.o: video.c all: $(OBJ)
$(CC) $(CFLAGS) -c video.c -o video.o
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@

View File

@ -1,20 +1,10 @@
SRC = $(wildcard *.c)
OBJ = $(SRC:.c=.o)
CFLAGS += -I . CFLAGS += -I .
.PHONY: all
all: ktest.o bitree.o kfifo.o mutex.o idr.o all: $(OBJ)
ktest.o: ktest.c %.o: %.c
$(CC) $(CFLAGS) -c ktest.c -o ktest.o $(CC) $(CFLAGS) -c $< -o $@
bitree.o: test-bitree.c
$(CC) $(CFLAGS) -c test-bitree.c -o test-bitree.o
kfifo.o: test-kfifo.c
$(CC) $(CFLAGS) -c test-kfifo.c -o test-kfifo.o
mutex.o: test-mutex.c
$(CC) $(CFLAGS) -c test-mutex.c -o test-mutex.o
idr.o: test-idr.c
$(CC) $(CFLAGS) -c test-idr.c -o test-idr.o

View File

@ -1,8 +1,10 @@
SRC = $(wildcard *.c)
OBJ = $(SRC:.c=.o)
CFLAGS += -I . CFLAGS += -I .
.PHONY: all
all: syscall.o all: $(OBJ)
syscall.o: syscall.c %.o: %.c
$(CC) $(CFLAGS) -c syscall.c -o syscall.o $(CC) $(CFLAGS) -c $< -o $@