From: John Hodge Date: Sun, 27 Dec 2009 02:38:40 +0000 (+0800) Subject: Updated build system to remove `install` from `all` X-Git-Tag: rel0.06~356 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=c7c5c4dbeb7b298675856eebb36084c92e989d98;p=tpg%2Facess2.git Updated build system to remove `install` from `all` - Also created a common makefile for Usermode/Applications to reduce make bugs - Updated Inode_ClearCache to actually delete the cache correctly (thanks SmSpilaz) --- diff --git a/Kernel/Makefile b/Kernel/Makefile index 17616e72..10c63ff3 100644 --- a/Kernel/Makefile +++ b/Kernel/Makefile @@ -38,13 +38,16 @@ DEPFILES := $(DEPFILES:%.o.$(ARCH)=%.d.$(ARCH)) SRCFILES = $(OBJ:%.o.$(ARCH)=%.c) SRCFILES := $(SRCFILES:%.ao.$(ARCH)=%.asm) -.PHONY: all clean apidoc +.PHONY: all clean install apidoc all: $(BIN) clean: @$(RM) $(BIN) $(BIN).dsm ../Map.$(ARCH).txt LineCounts.$(ARCH).txt $(OBJ) $(DEPFILES) +install: $(BIN) + $(xCP) $(BIN) $(DISTROOT) + apidoc: doxygen Doxyfile.api @@ -52,7 +55,6 @@ $(BIN): $(OBJ) $(MODS) arch/$(ARCHDIR)/link.ld Makefile @echo --- LD -o $(BIN) @$(LD) $(LDFLAGS) -o $(BIN) $(OBJ) $(MODS) -Map ../Map.$(ARCH).txt @objdump $(BIN) -D > $(BIN).dsm - $(xCP) $(BIN) $(DISTROOT) @wc -l $(SRCFILES) > LineCounts.$(ARCH).txt @echo BUILD_NUM = `calc $(BUILD_NUM)+1` > Makefile.BuildNum diff --git a/Kernel/Makefile.BuildNum b/Kernel/Makefile.BuildNum index 05201c78..c2a30d62 100644 --- a/Kernel/Makefile.BuildNum +++ b/Kernel/Makefile.BuildNum @@ -1 +1 @@ -BUILD_NUM = 1074 +BUILD_NUM = 1078 diff --git a/Kernel/vfs/nodecache.c b/Kernel/vfs/nodecache.c index 983f3f77..a85e5184 100644 --- a/Kernel/vfs/nodecache.c +++ b/Kernel/vfs/nodecache.c @@ -161,7 +161,12 @@ void Inode_ClearCache(int Handle) tInodeCache *prev = (tInodeCache*) &gVFS_InodeCache; tCachedInode *ent, *next; - cache = Inode_int_GetFSCache(Handle); + // Find the cache + for( + cache = gVFS_InodeCache; + cache && cache->Handle < Handle; + prev = cache, cache = cache->Next + ); if(!cache) return; // Search Cache diff --git a/Makefile b/Makefile index 1aad518b..9a861fde 100644 --- a/Makefile +++ b/Makefile @@ -1,42 +1,60 @@ # # Acess2 Core Makefile # +# (Oh man! This is hacky, but beautiful at the same time, much like the +# rest of Acess) .PHONY: all clean +SUBMAKE = $(MAKE) --no-print-directory + MODULES = FS_Ext2 FDD BochsGA IPStack NE2000 USB USRLIBS = ld-acess.so libacess.so libgcc.so libc.so USRAPPS = init login CLIShell cat ls mount ifconfig -all: - @echo === Filesystem && $(MAKE) all --no-print-directory -C Usermode/Filesystem - @for mod in $(MODULES); do \ - (echo === Module: $$mod && $(MAKE) all --no-print-directory -C Modules/$$mod) \ - done - - @echo === Kernel - @$(MAKE) all --no-print-directory -C Kernel - - @for lib in $(USRLIBS); do \ - (echo === User Library: $$lib && $(MAKE) all --no-print-directory -C Usermode/Libraries/`echo $$lib`_src) \ - done - - @for app in $(USRAPPS); do \ - (echo === User Application: $$app && $(MAKE) all --no-print-directory -C Usermode/Applications/`echo $$app`_src) \ - done - -clean: -# @$(MAKE) clean --no-print-directory -C Usermode/Filesystem - @for mod in $(MODULES); do \ - ($(MAKE) clean --no-print-directory -C Modules/$$mod) \ - done - - @make clean --no-print-directory -C Kernel/ - - @for lib in $(USRLIBS); do \ - ($(MAKE) clean --no-print-directory -C Usermode/Libraries/`echo $$lib`_src) \ - done - - @for app in $(USRAPPS); do \ - ($(MAKE) clean --no-print-directory -C Usermode/Applications/`echo $$app`_src) \ - done +ALL_MODULES = $(addprefix all-,$(MODULES)) +ALL_USRLIBS = $(addprefix all-,$(USRLIBS)) +ALL_USRAPPS = $(addprefix all-,$(USRAPPS)) +CLEAN_MODULES = $(addprefix clean-,$(MODULES)) +CLEAN_USRLIBS = $(addprefix clean-,$(USRLIBS)) +CLEAN_USRAPPS = $(addprefix clean-,$(USRAPPS)) +INSTALL_MODULES = $(addprefix install-,$(MODULES)) +INSTALL_USRLIBS = $(addprefix install-,$(USRLIBS)) +INSTALL_USRAPPS = $(addprefix install-,$(USRAPPS)) + +.PHONY: all clean install \ + $(ALL_MODULES) all-Kernel $(ALL_USRLIBS) $(ALL_USRAPPS) \ + $(CLEAN_MODULES) clean-Kernel $(CLEAN_USRLIBS) $(CLEAN_USRAPPS) \ + $(INSTALL_MODULES) install-Kernel $(INSTALL_USRLIBS) $(INSTALL_USRAPPS) + +all: $(ALL_MODULES) all-Kernel $(ALL_USRLIBS) $(ALL_USRAPPS) +clean: $(CLEAN_MODULES) clean-Kernel $(CLEAN_USRLIBS) $(CLEAN_USRAPPS) +install: $(INSTALL_MODULES) install-Kernel $(INSTALL_USRLIBS) $(INSTALL_USRAPPS) + + +$(ALL_MODULES): all-%: + @echo === Module: $* && $(SUBMAKE) all -C Modules/$* +all-Kernel: + @echo === Kernel && $(SUBMAKE) all -C Kernel +$(ALL_USRLIBS): all-%: + @echo === User Library: $* && $(SUBMAKE) all -C Usermode/Libraries/$*_src +$(ALL_USRAPPS): all-%: + @echo === User Application: $* && $(SUBMAKE) all -C Usermode/Applications/$*_src + +$(CLEAN_MODULES): clean-%: + @$(SUBMAKE) clean -C Modules/$* +clean-Kernel: + @$(SUBMAKE) clean -C Kernel +$(CLEAN_USRLIBS): clean-%: + @$(SUBMAKE) clean -C Usermode/Libraries/$*_src +$(CLEAN_USRAPPS): clean-%: + @$(SUBMAKE) clean -C Usermode/Applications/$*_src + +$(INSTALL_MODULES): install-%: + @$(SUBMAKE) install -C Modules/$* +install-Kernel: + @$(SUBMAKE) install -C Kernel +$(INSTALL_USRLIBS): install-%: + @$(SUBMAKE) install -C Usermode/Libraries/$*_src +$(INSTALL_USRAPPS): install-%: + @$(SUBMAKE) install -C Usermode/Applications/$*_src diff --git a/Modules/Makefile.tpl b/Modules/Makefile.tpl index 8a09edbe..06275590 100644 --- a/Modules/Makefile.tpl +++ b/Modules/Makefile.tpl @@ -23,12 +23,13 @@ all: $(BIN) clean: $(RM) $(BIN) $(BIN).dsm $(KOBJ) $(OBJ) $(DEPFILES) +install: $(BIN) + $(xCP) $(BIN) $(DISTROOT)/Modules/$(NAME).kmd + $(BIN): $(OBJ) @echo --- $(LD) -o $@ @$(LD) -T ../link.ld -shared -nostdlib -o $@ $(OBJ) -# @$(LD) -shared -nostdlib -o $@ $(OBJ) @$(OBJDUMP) -d $(BIN) > $(BIN).dsm - $(xCP) $@ $(DISTROOT)/Modules/$(NAME).kmd @echo --- $(LD) -o $(KOBJ) @$(CC) -Wl,-r -nostdlib -o $(KOBJ) $(OBJ) diff --git a/Usermode/Applications/CLIShell_src/Makefile b/Usermode/Applications/CLIShell_src/Makefile index ca2d9889..01b49eed 100644 --- a/Usermode/Applications/CLIShell_src/Makefile +++ b/Usermode/Applications/CLIShell_src/Makefile @@ -3,25 +3,8 @@ -include ../Makefile.cfg CPPFLAGS += -I./include -CFLAGS += -Wall -fno-builtin -fno-stack-protector -LDFLAGS += BIN = ../CLIShell -COBJ = main.o lib.o +OBJ = main.o lib.o -.PHONY : all clean - -all: $(BIN) - -clean: - $(RM) $(COBJ) $(BIN) $(BIN).dsm Map.txt - -$(BIN): $(COBJ) - @echo --- $(LD) -o $@ - @$(LD) $(LDFLAGS) -o $@ $(COBJ) -Map Map.txt - objdump -d $(BIN) > $(BIN).dsm - $(xCP) $(BIN) $(DISTROOT)/Bin/ - -$(COBJ): %.o: %.c - @echo --- GCC -o $@ - @$(CC) $(CFLAGS) -c $? -o $@ +-include ../Makefile.tpl diff --git a/Usermode/Applications/Makefile.tpl b/Usermode/Applications/Makefile.tpl new file mode 100644 index 00000000..d3582703 --- /dev/null +++ b/Usermode/Applications/Makefile.tpl @@ -0,0 +1,25 @@ +# Acess2 - Application Template Makefile +# +# + +CFLAGS += -Wall -fno-builtin -fno-stack-protector +LDFLAGS += + +.PHONY : all clean install + +all: $(BIN) + +clean: + @$(RM) $(OBJ) $(BIN) $(BIN).dsm Map.txt + +install: $(BIN) + $(xCP) $(BIN) $(DISTROOT)/Bin/ + +$(BIN): $(OBJ) + @echo --- $(LD) -o $@ + @$(LD) $(LDFLAGS) -o $@ $(OBJ) -Map Map.txt + @objdump -d $(BIN) > $(BIN).dsm + +$(OBJ): %.o: %.c + @echo --- GCC -o $@ + @$(CC) $(CFLAGS) $(CPPFLAGS) -c $? -o $@ diff --git a/Usermode/Applications/cat_src/Makefile b/Usermode/Applications/cat_src/Makefile index 9fe79a65..9c968f43 100644 --- a/Usermode/Applications/cat_src/Makefile +++ b/Usermode/Applications/cat_src/Makefile @@ -2,26 +2,8 @@ -include ../Makefile.cfg -COBJ = main.o +OBJ = main.o BIN = ../cat -CFLAGS += -Wall -fno-builtin -fno-stack-protector -LDFLAGS += - -.PHONY : all clean - -all: $(BIN) - -$(BIN): $(COBJ) - @echo --- $(LD) -o $@ - @$(LD) $(LDFLAGS) -o $@ $(COBJ) -Map Map.txt - objdump -d $(BIN) > $(BIN).dsm - $(xCP) $(BIN) $(DISTROOT)/Bin/ - -clean: - $(RM) $(COBJ) $(BIN) $(BIN).dsm Map.txt - -$(COBJ): %.o: %.c - @echo --- GCC -o $@ - @$(CC) $(CFLAGS) -c $? -o $@ +-include ../Makefile.tpl diff --git a/Usermode/Applications/ifconfig_src/Makefile b/Usermode/Applications/ifconfig_src/Makefile index 8b6ccff0..a7035213 100644 --- a/Usermode/Applications/ifconfig_src/Makefile +++ b/Usermode/Applications/ifconfig_src/Makefile @@ -2,26 +2,8 @@ -include ../Makefile.cfg -COBJ = main.o +OBJ = main.o BIN = ../ifconfig -CFLAGS += -Wall -fno-builtin -fno-stack-protector -LDFLAGS += - -.PHONY : all clean - -all: $(BIN) - -$(BIN): $(COBJ) - @echo --- $(LD) -o $@ - @$(LD) $(LDFLAGS) -o $@ $(COBJ) -Map Map.txt - @objdump -d $(BIN) > $(BIN).dsm - $(xCP) $(BIN) $(DISTROOT)/Bin/ - -clean: - @$(RM) $(COBJ) $(BIN) $(BIN).dsm Map.txt - -$(COBJ): %.o: %.c - @echo --- GCC -o $@ - @$(CC) $(CFLAGS) -c $? -o $@ +-include ../Makefile.tpl diff --git a/Usermode/Applications/init_src/Makefile b/Usermode/Applications/init_src/Makefile index 4541f629..23d7c276 100644 --- a/Usermode/Applications/init_src/Makefile +++ b/Usermode/Applications/init_src/Makefile @@ -9,19 +9,4 @@ LDFLAGS += BIN = ../init OBJ = main.o -.PHONY: all clean - -all: $(BIN) - -clean: - $(RM) $(BIN) $(OBJ) $(BIN).dsm - -$(BIN): $(OBJ) Makefile - @echo --- ld -o $(BIN) - @$(LD) $(LDFLAGS) $(OBJ) -o $(BIN) - $(OBJDUMP) -d $(BIN) > $(BIN).dsm - $(xCP) $(BIN) $(DISTROOT)/SBin/ - -%.o: %.c - @echo --- $(CC) -o $@ - @$(CC) $(CFLAGS) -c $< -o $@ +-include ../Makefile.tpl diff --git a/Usermode/Applications/login_src/Makefile b/Usermode/Applications/login_src/Makefile index 717a15fd..239f6ff9 100644 --- a/Usermode/Applications/login_src/Makefile +++ b/Usermode/Applications/login_src/Makefile @@ -4,26 +4,7 @@ DBTYPE = tpl -CPPFLAGS += -CFLAGS += -fno-stack-protector -Wall -Werror -O3 $(CPPFLAGS) -LDFLAGS += -lgcc -lc - OBJ = main.o database_$(DBTYPE).o BIN = ../login -.PHONY: all clean - -all: $(BIN) - -clean: - $(RM) $(BIN) $(OBJ) login.dsm - -$(BIN): $(OBJ) - @echo --- $(LD) -o $@ - @$(LD) $(LDFLAGS) $(OBJ) -o $@ - $(xCP) $(BIN) $(DISTROOT)/SBin/ - objdump -d $(BIN) > login.dsm - -%.o: %.c Makefile - @echo --- $(CC) -o $@ - @$(CC) $(CFLAGS) -c $< -o $@ +-include ../Makefile.tpl diff --git a/Usermode/Applications/ls_src/Makefile b/Usermode/Applications/ls_src/Makefile index 75656249..0ea66db4 100644 --- a/Usermode/Applications/ls_src/Makefile +++ b/Usermode/Applications/ls_src/Makefile @@ -2,26 +2,7 @@ -include ../Makefile.cfg -COBJ = main.o +OBJ = main.o BIN = ../ls -CFLAGS += -Wall -fno-builtin -LDFLAGS += - -.PHONY : all clean - -all: $(BIN) - -$(BIN): $(COBJ) - @echo --- $(LD) -o $@ - @$(LD) $(LDFLAGS) -o $@ $(COBJ) -Map Map.txt - objdump -d $(BIN) > $(BIN).dsm - $(xCP) $(BIN) $(DISTROOT)/Bin/ - -clean: - $(RM) $(COBJ) $(BIN) $(BIN).dsm Map.txt - -$(COBJ): %.o: %.c - @echo --- GCC -o $@ - @$(CC) $(CFLAGS) -c $? -o $@ - +-include ../Makefile.tpl diff --git a/Usermode/Applications/mount_src/Makefile b/Usermode/Applications/mount_src/Makefile index 3f5439d4..842de666 100644 --- a/Usermode/Applications/mount_src/Makefile +++ b/Usermode/Applications/mount_src/Makefile @@ -2,26 +2,8 @@ -include ../Makefile.cfg -COBJ = main.o +OBJ = main.o BIN = ../mount -CFLAGS += -Wall -fno-builtin -fno-stack-protector -LDFLAGS += - -.PHONY : all clean - -all: $(BIN) - -$(BIN): $(COBJ) - @echo --- $(LD) -o $@ - @$(LD) $(LDFLAGS) -o $@ $(COBJ) -Map Map.txt - objdump -d $(BIN) > $(BIN).dsm - $(xCP) $(BIN) $(DISTROOT)/Bin/ - -clean: - $(RM) $(COBJ) $(BIN) Map.txt $(BIN).dsm - -$(COBJ): %.o: %.c - @echo --- GCC -o $@ - @$(CC) $(CFLAGS) -c $? -o $@ +-include ../Makefile.tpl diff --git a/Usermode/Filesystem/Makefile b/Usermode/Filesystem/Makefile index ef1f6b2b..093ea71a 100644 --- a/Usermode/Filesystem/Makefile +++ b/Usermode/Filesystem/Makefile @@ -23,3 +23,5 @@ $(DIRS): $(FILES): $(xCP) $< $(DISTROOT)/$@ + +force: ; diff --git a/Usermode/Libraries/ld-acess.so_src/Makefile b/Usermode/Libraries/ld-acess.so_src/Makefile index d0b49a44..7c3a4b8c 100644 --- a/Usermode/Libraries/ld-acess.so_src/Makefile +++ b/Usermode/Libraries/ld-acess.so_src/Makefile @@ -13,19 +13,21 @@ ASFLAGS = -felf LDFLAGS = -T link.ld -Map map.txt -Bstatic -.PHONY: all clean +.PHONY: all clean install all: $(BIN) clean: $(RM) $(BIN) $(AOBJ) $(COBJ) ld-acess.dmp ld-acess.dsm link.txt map.txt +install: $(BIN) + $(xCP) $(BIN) $(DISTROOT)/Libs/ + $(BIN): $(AOBJ) $(COBJ) @echo --- $(LD) -shared -o $@ @$(LD) $(LDFLAGS) -o $(BIN) $(AOBJ) $(COBJ) > link.txt $(OBJDUMP) -x $(BIN) > ld-acess.dmp - $(OBJDUMP) -d $(BIN) > ld-acess.dsm - $(xCP) $(BIN) $(DISTROOT)/Libs/ + $(OBJDUMP) -d $(BIN) > ld-acess.dsm $(COBJ): %.o: %.c @echo $(CC) -o $@ diff --git a/Usermode/Libraries/libacess.so_src/Makefile b/Usermode/Libraries/libacess.so_src/Makefile index 5d49668c..9acb5ebc 100644 --- a/Usermode/Libraries/libacess.so_src/Makefile +++ b/Usermode/Libraries/libacess.so_src/Makefile @@ -10,18 +10,20 @@ LDFLAGS = -nostdlib -shared -I/Acess/Libs/ld-acess.so -e SoMain OBJ = core.ao vfs.ao mm.ao BIN = ../libacess.so -.PHONY: all clean +.PHONY: all clean install all: $(BIN) clean: $(RM) $(BIN) $(OBJ) +install: + $(xCP) $(BIN) $(DISTROOT)/Libs + $(BIN): $(OBJ) @echo --- $(LD) -shared -o $@ @$(LD) $(LDFLAGS) -o $(BIN) $(OBJ) @$(STRIP) $(BIN) - $(xCP) $(BIN) $(DISTROOT)/Libs %.ao: %.asm syscalls.inc.asm @echo $(AS) -o $@ diff --git a/Usermode/Libraries/libc.so_src/Makefile b/Usermode/Libraries/libc.so_src/Makefile index bf7b8d15..1e3fc465 100644 --- a/Usermode/Libraries/libc.so_src/Makefile +++ b/Usermode/Libraries/libc.so_src/Makefile @@ -13,13 +13,16 @@ DEPFILES := $(OBJ:%.o=%.d) # signals.o BIN = ../libc.so.1 -.PHONY: all clean +.PHONY: all clean install all: $(BIN) clean: $(RM) $(BIN) ../libc.so $(OBJ) $(DEPFILES) libc.so.1.dsm libc.so.1.dmp map.txt +install: $(BIN) + $(xCP) ../libc.so.1 $(DISTROOT)/Libs/ + # Core C Library $(BIN): $(OBJ) @echo --- ld -shared -o $@ @@ -27,7 +30,6 @@ $(BIN): $(OBJ) @$(OBJDUMP) -d $@ > libc.so.1.dsm @$(OBJDUMP) -x -r -R $@ > libc.so.1.dmp cp ../libc.so.1 ../libc.so - $(xCP) ../libc.so.1 $(DISTROOT)/Libs/ # C Runtime 0 ../crt0.o: crt0.asm diff --git a/Usermode/Libraries/libgcc.so_src/Makefile b/Usermode/Libraries/libgcc.so_src/Makefile index 5308e7de..b6f5b70d 100644 --- a/Usermode/Libraries/libgcc.so_src/Makefile +++ b/Usermode/Libraries/libgcc.so_src/Makefile @@ -10,18 +10,20 @@ BIN = ../libgcc.so CFLAGS += -Wall -Werror LDFLAGS += -soname libgcc.so -.PHONY: all clean +.PHONY: all clean install all: $(BIN) clean: $(RM) $(BIN) $(OBJS) libgcc.so.dsm +install: $(BIN) + $(xCP) $(BIN) $(DISTROOT)/Libs + $(BIN): $(OBJS) @echo -- ld -o $@ @$(LD) $(LDFLAGS) -o $(BIN) $(OBJS) @$(OBJDUMP) -d $(BIN) > libgcc.so.dsm - $(xCP) $(BIN) $(DISTROOT)/Libs $(OBJS): %.o: %.c @echo -- gcc -o $@