1SUBDIRS = kernel user 2 3 4 5 6export ARCH=__x86_64__ 7export ROOT_PATH=$(shell pwd) 8 9export DEBUG=DEBUG 10export GLOBAL_CFLAGS := -mcmodel=large -fno-builtin -m64 -fno-stack-protector -D $(ARCH) -O1 11 12ifeq ($(DEBUG), DEBUG) 13GLOBAL_CFLAGS += -g 14endif 15 16.PHONY: all 17all: kernel user 18 19 20 21.PHONY: kernel 22kernel: 23 mkdir -p bin/kernel/ 24 @list='./kernel'; for subdir in $$list; do \ 25 echo "make all in $$subdir";\ 26 cd $$subdir;\ 27 $(MAKE) all;\ 28 cd ..;\ 29 done 30 31.PHONY: user 32user: 33 mkdir -p bin/user/ 34 mkdir -p bin/tmp/ 35 @list='./user'; for subdir in $$list; do \ 36 echo "make all in $$subdir";\ 37 cd $$subdir;\ 38 $(MAKE) all;\ 39 cd ..;\ 40 done 41 42.PHONY: clean 43clean: 44 @list='$(SUBDIRS)'; for subdir in $$list; do \ 45 echo "Clean in dir: $$subdir";\ 46 cd $$subdir && $(MAKE) clean;\ 47 cd .. ;\ 48 done 49 50gdb: 51 gdb -n -x tools/.gdbinit