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 -O0 -fno-stack-protector -D $(ARCH) 11 12ifeq ($(DEBUG), DEBUG) 13GLOBAL_CFLAGS += -g 14endif 15 16.PHONY: all 17all: 18 mkdir -p bin/kernel/ 19 mkdir -p bin/user/ 20 mkdir -p bin/tmp/ 21 @list='$(SUBDIRS)'; for subdir in $$list; do \ 22 echo "make all in $$subdir";\ 23 cd $$subdir;\ 24 $(MAKE) all;\ 25 cd ..;\ 26 done 27 28.PHONY: user 29user: 30 mkdir -p bin/user/ 31 mkdir -p bin/tmp/ 32 @list='./user'; for subdir in $$list; do \ 33 echo "make all in $$subdir";\ 34 cd $$subdir;\ 35 $(MAKE) all;\ 36 cd ..;\ 37 done 38 39.PHONY: clean 40clean: 41 @list='$(SUBDIRS)'; for subdir in $$list; do \ 42 echo "Clean in dir: $$subdir";\ 43 cd $$subdir && $(MAKE) clean;\ 44 cd .. ;\ 45 done 46 47gdb: 48 gdb -n -x tools/.gdbinit