-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make the buildsystem more consistent
Used to be, when you made a change in the libc, the kernel didn't get rebuilt by a call to `make`. Now it does! I _will_ get the hang of Makefile good practices. Still an inconvenience in the way modules (aka apps) are built: they each have all of the other as dependencies, so a change in one triggers a rebuild of all of them.
- Loading branch information
Showing
11 changed files
with
85 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,50 @@ | ||
LIBK_CFLAGS:=$(CFLAGS) -D_KERNEL_ | ||
CFLAGS+=-Wno-format | ||
|
||
OBJS:=$(patsubst %.c,%.o,$(wildcard src/*/*.c)) | ||
OBJS+=$(patsubst %.c,%.o,$(wildcard src/*.c)) | ||
|
||
|
||
OBJS+=$(patsubst %.S,%.o,$(wildcard src/*/*.S)) | ||
OBJS+=$(patsubst %.S,%.o,$(wildcard src/*.S)) | ||
OBJS+=$(patsubst %.c,%.o,$(shell find src/ -name '*.c')) | ||
OBJS+=$(patsubst %.S,%.o,$(shell find src/ -name '*.S')) | ||
|
||
LIBK_OBJS:=$(OBJS:.o=.libk.o) | ||
|
||
# libk is libc but compiled with _KERNEL_ defined | ||
BINARIES=libc.a libk.a | ||
LIBC=$(LIBDIR)/libc.a | ||
LIBK=$(LIBDIR)/libk.a | ||
|
||
all: $(BINARIES) | ||
.PHONY: all clean build install-headers | ||
|
||
.PHONY: all clean build install-headers install-libs | ||
|
||
libc.a: $(OBJS) | ||
$(info [libc] linking $@) | ||
$(LIBC): $(OBJS) | ||
$(info [libc] linking $(notdir $@)) | ||
@mkdir -p $(LIBDIR) | ||
@$(AR) rcs $@ $(OBJS) | ||
|
||
libk.a: $(LIBK_OBJS) | ||
$(info [libc] linking $@) | ||
$(LIBK): $(LIBK_OBJS) | ||
$(info [libc] linking $(notdir $@)) | ||
@mkdir -p $(LIBDIR) | ||
@$(AR) rcs $@ $(LIBK_OBJS) | ||
|
||
%.o: %.c | ||
$(info [libc] building $@) | ||
$(info [libc] $@) | ||
@$(CC) -c $< -o $@ $(CFLAGS) | ||
|
||
%.o: %.S | ||
$(info [libc] building $@) | ||
$(info [libc] $@) | ||
@$(CC) -c $< -o $@ $(CFLAGS) | ||
|
||
%.libk.o: %.c | ||
$(info [libc] building $@) | ||
$(info [libc] $@) | ||
@$(CC) -c $< -o $@ $(LIBK_CFLAGS) | ||
|
||
%.libk.o: %.S | ||
$(info [libc] building $@) | ||
$(info [libc] $@) | ||
@$(CC) -c $< -o $@ $(LIBK_CFLAGS) | ||
|
||
clean: | ||
$(info [libc] cleaning up) | ||
@rm -f $(BINARIES) $(OBJS) $(LIBK_OBJS) *.o */*.o */*/*.o | ||
@rm -f $(OBJS) $(LIBK_OBJS) *.o */*.o */*/*.o | ||
|
||
build: install-libs | ||
build: $(LIBC) $(LIBK) | ||
|
||
install-headers: | ||
$(info [libc] installing headers) | ||
@mkdir -p $(SYSROOT)/$(INCLUDEDIR) | ||
@cp -rT include $(SYSROOT)/$(INCLUDEDIR) | ||
|
||
install-libs: $(BINARIES) | ||
$(info [libc] installing shared libraries) | ||
@mkdir -p $(SYSROOT)/$(LIBDIR) | ||
@cp $(BINARIES) $(SYSROOT)/$(LIBDIR) | ||
@mkdir -p $(INCLUDEDIR) | ||
@cp -rT include $(INCLUDEDIR) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,30 @@ | ||
OBJS=$(patsubst %.c,%.o,$(wildcard src/*.c)) | ||
OBJS+=$(patsubst %.S,%.o,$(wildcard src/*.S)) | ||
|
||
all: libsnow.a | ||
LIBSNOW=$(LIBDIR)/libsnow.a | ||
|
||
.PHONY: all clean build install-headers install-libs | ||
.PHONY: all clean build install-headers | ||
|
||
libsnow.a: $(OBJS) | ||
$(info [snow] linking $@) | ||
$(LIBSNOW): $(OBJS) | ||
$(info [snow] linking $(notdir $@)) | ||
mkdir -p $(LIBDIR) | ||
@$(AR) rcs $@ $(OBJS) | ||
|
||
%.o: %.c | ||
$(info [snow] building $@) | ||
$(info [snow] $@) | ||
@$(CC) -c $< -o $@ $(CFLAGS) | ||
|
||
%.o: %.S | ||
$(info [snow] building $@) | ||
$(info [snow] $@) | ||
@$(CC) -c $< -o $@ $(CFLAGS) | ||
|
||
clean: | ||
$(info [snow] cleaning up) | ||
@rm -f *.a $(OBJS) | ||
|
||
build: install-libs | ||
build: $(LIBSNOW) | ||
|
||
install-headers: | ||
$(info [snow] installing headers) | ||
@mkdir -p $(SYSROOT)/$(INCLUDEDIR) | ||
@cp -rT include $(SYSROOT)/$(INCLUDEDIR) | ||
|
||
install-libs: libsnow.a | ||
$(info [snow] installing shared libraries) | ||
@mkdir -p $(SYSROOT)/$(LIBDIR) | ||
@cp libsnow.a $(SYSROOT)/$(LIBDIR) | ||
@mkdir -p $(INCLUDEDIR) | ||
@cp -rT include $(INCLUDEDIR) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,26 @@ | ||
OBJS=$(patsubst %.c,%.o,$(wildcard src/*.c)) | ||
OBJS+=$(patsubst %.S,%.o,$(wildcard src/*.S)) | ||
|
||
all: libui.a | ||
LIBUI=$(LIBDIR)/libui.a | ||
|
||
.PHONY: all clean build install-headers install-libs | ||
.PHONY: all clean build install-headers | ||
|
||
libui.a: $(OBJS) | ||
$(info [ui] linking $@) | ||
$(LIBUI): $(OBJS) | ||
$(info [ui] linking $(notdir $@)) | ||
@mkdir -p $(LIBDIR) | ||
@$(AR) rcs $@ $(OBJS) | ||
|
||
%.o: %.c | ||
$(info [ui] building $@) | ||
$(info [ui] $@) | ||
@$(CC) -c $< -o $@ $(CFLAGS) | ||
|
||
clean: | ||
$(info [ui] building $@) | ||
$(info [ui] $@) | ||
@rm -f *.a $(OBJS) | ||
|
||
build: install-libs | ||
build: $(LIBUI) | ||
|
||
install-headers: | ||
$(info [ui] installing headers) | ||
@mkdir -p $(SYSROOT)/$(INCLUDEDIR) | ||
@cp -rT include $(SYSROOT)/$(INCLUDEDIR) | ||
|
||
install-libs: libui.a | ||
$(info [ui] installing shared libraries) | ||
@mkdir -p $(SYSROOT)/$(LIBDIR) | ||
@cp libui.a $(SYSROOT)/$(LIBDIR) | ||
@mkdir -p $(INCLUDEDIR) | ||
@cp -rT include $(INCLUDEDIR) |