Makefile Troubles...
Posted: Thu Aug 23, 2007 1:13 am
I'm trying to clean up the source tree of my OS, and in the process am trying to make a "root" makefile that means that you can do everything from within one folder.
Currently I have this:
It prints out:
If I change into the child directories (eg. cd "Userland/mattise_lib", pretty much what "clean" and "install" use except with "all"):
The command to produce the above is:
Any ideas?
Edit: One thing, this _does_ work:
Currently I have this:
Code: Select all
# makes everything
all:
$(MAKE) -f kernel.mk all
$(MAKE) -f Userland/mattise_lib/Makefile all
$(MAKE) -f Userland/Makefile all
# cleans everything
clean:
@$(MAKE) -f kernel.mk clean
@cd Userland/mattise_lib
@$(MAKE) clean
@cd ../../
@$(MAKE) -f Userland/Makefile clean
#installs everything
install:
@$(MAKE) -f kernel.mk install
@cd Userland/mattise_lib
@$(MAKE) install
@$(MAKE) -f Userland/Makefile install
# builds the kernel
kernel_all:
@$(MAKE) -f kernel.mk all
# cleans the kernel
kernel_clean:
@$(MAKE) -f kernel.mk clean
# installs the kernel
kernel_install:
@$(MAKE) -f kernel.mk install
# builds all the userland software
userland_all:
@$(MAKE) -f Userland/Makefile all
# cleans all the userland software
userland_clean:
@$(MAKE) -f Userland/Makefile clean
# installs all the userland software
userland_install:
@$(MAKE) -f Userland/Makefile install
# builds the mattise library
mattiselib_all:
@cd Userland/mattise_lib
@$(MAKE) all
# cleans the mattise library
mattiselib_clean:
@cd Userland/mattise_lib
@$(MAKE) clean
# installs the mattise library
mattiselib_install:
@cd Userland/mattise_lib
@$(MAKE) install
Code: Select all
$ make all
make -f kernel.mk all
make[1]: Entering directory `/cygdrive/c/osdev/mattiseos/cpp_kernel'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/cygdrive/c/osdev/mattiseos/cpp_kernel'
make -f Userland/mattise_lib/Makefile all
make[1]: Entering directory `/cygdrive/c/osdev/mattiseos/cpp_kernel'
make[1]: *** No rule to make target `crt0.o', needed by `mattise.a'. Stop.
make[1]: Leaving directory `/cygdrive/c/osdev/mattiseos/cpp_kernel'
make: *** [all] Error 2
Code: Select all
$ make all
make -f kernel.mk all
make[1]: Entering directory `/cygdrive/c/osdev/mattiseos/cpp_kernel'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/cygdrive/c/osdev/mattiseos/cpp_kernel'
cd Userland/mattise_lib
make all
make[1]: Entering directory `/cygdrive/c/osdev/mattiseos/cpp_kernel'
make -f kernel.mk all
make[2]: Entering directory `/cygdrive/c/osdev/mattiseos/cpp_kernel'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/cygdrive/c/osdev/mattiseos/cpp_kernel'
cd Userland/mattise_lib
make all
make[2]: Entering directory `/cygdrive/c/osdev/mattiseos/cpp_kernel'
make -f kernel.mk all
make[2]: *** [all] Interrupt
make[1]: *** [all] Interrupt
make: *** [all] Interrupt
Code: Select all
$(MAKE) -f kernel.mk all
cd Userland/mattise_lib
$(MAKE) all
cd ../../
$(MAKE) -f Userland/Makefile all
Edit: One thing, this _does_ work:
Code: Select all
# builds the mattise library
mattiselib_all:
cd Userland/mattise_lib
$(MAKE) all