xref: /DragonOS/Makefile (revision 416a802b9cdb8a4172a98c4c48893b402cc2b348)
10aec6827SfslongjinSUBDIRS = kernel user
20aec6827Sfslongjin
3*416a802bSfslongjin# ifndef $(EMULATOR)
4*416a802bSfslongjinifeq ($(EMULATOR), )
5*416a802bSfslongjinexport EMULATOR=__NO_EMULATION__
6*416a802bSfslongjinendif
70aec6827Sfslongjin
80aec6827Sfslongjin
9edb21695Sfslongjinexport ARCH=__x86_64__
100aec6827Sfslongjinexport ROOT_PATH=$(shell pwd)
110aec6827Sfslongjin
120aec6827Sfslongjinexport DEBUG=DEBUG
13*416a802bSfslongjinexport GLOBAL_CFLAGS := -mcmodel=large -fno-builtin -m64  -fno-stack-protector -D $(ARCH) -D $(EMULATOR) -O1
140aec6827Sfslongjin
150aec6827Sfslongjinifeq ($(DEBUG), DEBUG)
160aec6827SfslongjinGLOBAL_CFLAGS += -g
170aec6827Sfslongjinendif
18f479f321Sfslongjin
19*416a802bSfslongjin
20f479f321Sfslongjin.PHONY: all
211ab51cb3Sfslongjinall: kernel user
221ab51cb3Sfslongjin
231ab51cb3Sfslongjin
241ab51cb3Sfslongjin
251ab51cb3Sfslongjin.PHONY: kernel
261ab51cb3Sfslongjinkernel:
270b0cce93Sfslongjin	mkdir -p bin/kernel/
281ab51cb3Sfslongjin	@list='./kernel'; for subdir in $$list; do \
29f479f321Sfslongjin				echo "make all in $$subdir";\
30f479f321Sfslongjin				cd $$subdir;\
3105dc7ac7Sfslongjin				$(MAKE) all;\
32f479f321Sfslongjin				cd ..;\
33f479f321Sfslongjin		done
34f479f321Sfslongjin
35e2a59dbdSfslongjin.PHONY: user
36e2a59dbdSfslongjinuser:
37e2a59dbdSfslongjin	mkdir -p bin/user/
38e2a59dbdSfslongjin	mkdir -p bin/tmp/
39e2a59dbdSfslongjin	@list='./user'; for subdir in $$list; do \
40e2a59dbdSfslongjin    		echo "make all in $$subdir";\
41e2a59dbdSfslongjin    		cd $$subdir;\
42e2a59dbdSfslongjin    		 $(MAKE) all;\
43e2a59dbdSfslongjin    		cd ..;\
44e2a59dbdSfslongjin	done
45e2a59dbdSfslongjin
46f479f321Sfslongjin.PHONY: clean
47f479f321Sfslongjinclean:
48f479f321Sfslongjin	@list='$(SUBDIRS)'; for subdir in $$list; do \
49f479f321Sfslongjin		echo "Clean in dir: $$subdir";\
5005dc7ac7Sfslongjin		cd $$subdir && $(MAKE) clean;\
51f479f321Sfslongjin		cd .. ;\
52f479f321Sfslongjin	done
53e667fff2Sfslongjin
54e667fff2Sfslongjingdb:
55e667fff2Sfslongjin	gdb -n -x tools/.gdbinit