source: trunk/Makefile @ 449

Last change on this file since 449 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 6.0 KB
Line 
1#############################################################################
2#                         ALMOS-MKH Global Makefile                         #
3#############################################################################
4
5-include params-soft.mk
6ifeq ($(ARCH_NAME),)
7$(error Please define in ARCH_NAME parameter in params-soft.mk!)
8endif
9
10-include params-hard.mk
11
12# Default values for hardware parameters.
13# These parameters should be defined in the 'params-hard.mk' file.
14ARCH            ?= /users/alain/soc/tsar-trunk-svn-2013/platforms/tsar_generic_iob
15X_SIZE          ?= 2
16Y_SIZE          ?= 2
17NB_PROCS        ?= 2
18NB_TTYS         ?= 3
19FBF_WIDTH       ?= 256
20IOC_TYPE        ?= IOC_BDV
21
22# Checking hardware platform definition.
23ifeq ($(wildcard $(ARCH)),)
24$(error Please define in ARCH parameter the path to the hardware platform!)
25endif
26
27# Rules that don't build target files
28# always out-of-date, need to be regenerated everytime they are called
29.PHONY: compile                                \
30        hard_config.h                      \
31                dirs                                           \
32                list                                           \
33                extract                                        \
34                fsck                                           \
35                clean                                          \
36                build_libs                         \
37                build-disk                                     \
38                $(BOOTLOADER_PATH)/build/boot.elf  \
39                kernel/build/kernel.elf            \
40                user/init/build/init.elf           \
41                user/ksh/build/ksh.elf             \
42                user/pgdc/build/pgcd.elf           \
43                user/idbg/build/idbg.elf           \
44                user/sort/build/sort.elf
45
46# Virtual disk path
47DISK_IMAGE      := hdd/virt_hdd.dmg
48
49# The Mtools used to build the FAT32 disk image perfom a few sanity checks, to
50# make sure that the disk is indeed an MS-DOS disk. However, the size of the
51# disk image used by ALMOS-MKH is not MS-DOS compliant.
52# Setting this variable prevents these checks.
53MTOOLS_SKIP_CHECK := 1
54
55# Rule to generate boot.elf, kernel.elf, all user.elf files, and update virtual disk.
56compile: dirs                              \
57         build_disk                        \
58         hard_config.h                     \
59         build_libs                        \
60         $(BOOTLOADER_PATH)/build/boot.elf \
61         kernel/build/kernel.elf           \
62         user/init/build/init.elf          \
63         user/ksh/build/ksh.elf            \
64         user/pgcd/build/pgcd.elf          \
65         user/idbg/build/idbg.elf          \
66         user/sort/build/sort.elf          \
67         list
68
69# Rule to create the hdd directory
70dirs:
71        @mkdir -p hdd
72
73# Rule to make a recursive list of the virtual disk content.
74list:
75        mdir -/ -b -i $(DISK_IMAGE) ::/
76
77##############################################################
78# Rule to copy the files generated by the virtual prototype
79# from the virtual disk 'home' directory to the current directory.
80extract:
81        mcopy -o -i $(DISK_IMAGE) ::/home .
82
83# Rules to delete all binary files from Unix File System
84# without modifying the virtual disk.
85clean:
86        rm -f hard_config.h arch_info.xml arch_info.bin
87        rm -rf build
88        $(MAKE) -C kernel clean
89        $(MAKE) -C $(BOOTLOADER_PATH) clean
90        $(MAKE) -C $(LIBC_PATH) clean
91        $(MAKE) -C $(LIBPTHREAD_PATH) clean
92        $(MAKE) -C $(LIBALMOSMKH_PATH) clean
93        $(MAKE) -C user/init clean
94        $(MAKE) -C user/ksh clean
95        $(MAKE) -C user/sort clean
96        $(MAKE) -C user/pgcd clean
97        $(MAKE) -C user/idbg clean
98        $(MAKE) -C $(HAL_ARCH) clean
99
100####################################################   
101# Rule for building a new virtual disk from scratch.
102# It creates the bin, bin/kernel, bin/user, and home directories.
103# This requires the generic Linux/MacOS 'create_dmg' script, that should be
104# placed in the same directory as this Makefile.
105build_disk: dirs
106        rm -f $(DISK_IMAGE)
107        ./create_dmg    create $(basename $(DISK_IMAGE))
108        dd                              if=$(DISK_IMAGE) of=temp.dmg count=65536
109        mv                              temp.dmg $(DISK_IMAGE)
110        mmd                     -o -i $(DISK_IMAGE) ::/bin         || true
111        mmd                     -o -i $(DISK_IMAGE) ::/bin/kernel  || true
112        mmd                     -o -i $(DISK_IMAGE) ::/bin/user    || true
113        mmd                     -o -i $(DISK_IMAGE) ::/home        || true
114        mdir             -/ -b -i $(DISK_IMAGE) ::/
115       
116##############################################################
117# Rules to generate hardware description files (hard_config.h,
118# arch_info.bin and arch_info.xml), and update the virtual disk.
119hard_config.h: build_disk $(ARCH)/arch_info.py
120        tools/arch_info/genarch.py      --arch=$(ARCH)                  \
121                                                                --x_size=$(X_SIZE)              \
122                                                                --y_size=$(Y_SIZE)              \
123                                                                --nb_cores=$(NB_PROCS)  \
124                                                                --nb_ttys=$(NB_TTYS)    \
125                                                                --fbf_size=$(FBF_WIDTH) \
126                                                                --ioc_type=$(IOC_TYPE)  \
127                                                                --hard=.                                \
128                                                                --bin=.                                 \
129                                                                --xml=.                                 
130        mcopy -o -i $(DISK_IMAGE) arch_info.bin ::/   || true
131        mdir             -/ -b -i $(DISK_IMAGE) ::/
132
133############################################
134# Rules to generate the user level libraries
135build_libs: build_hal
136        $(MAKE) -C $(LIBALMOSMKH_PATH) headers
137        $(MAKE) -C $(LIBPTHREAD_PATH) headers
138        $(MAKE) -C $(LIBC_PATH)
139        $(MAKE) -C $(LIBALMOSMKH_PATH)
140        $(MAKE) -C $(LIBPTHREAD_PATH)
141
142#####################################################################
143# Rule to generate boot.elf and place it in sector #2 of virtual disk
144$(BOOTLOADER_PATH)/build/boot.elf:
145        $(MAKE) -C $(BOOTLOADER_PATH)
146        dd if=$@ of=$(DISK_IMAGE) seek=2 conv=notrunc
147
148#####################################################################
149# Rule to generate boot.elf and place it in sector #2 of virtual disk
150build_hal:
151        $(MAKE) -C $(HAL_ARCH)
152
153#############################################################
154# Rule to generate kernel.elf and place it on virtual disk
155kernel/build/kernel.elf: build_hal
156        $(MAKE) -C kernel/
157        mcopy -o -i $(DISK_IMAGE) $@ ::/bin/kernel
158
159#####################################################
160# Rules to generate user.elf and copy on virtual disk
161user/init/build/init.elf: build_libs
162        $(MAKE) -C user/init
163        mcopy -o -i $(DISK_IMAGE) $@ ::/bin/user
164user/ksh/build/ksh.elf: build_libs
165        $(MAKE) -C user/ksh
166        mcopy -o -i $(DISK_IMAGE) $@ ::/bin/user
167user/pgcd/build/pgcd.elf: build_libs
168        $(MAKE) -C user/pgcd
169        mcopy -o -i $(DISK_IMAGE) $@ ::/bin/user
170user/idbg/build/idbg.elf: build_libs
171        $(MAKE) -C user/idbg
172        mcopy -o -i $(DISK_IMAGE) $@ ::/bin/user
173user/sort/build/sort.elf: build_libs
174        $(MAKE) -C user/sort
175        mcopy -o -i $(DISK_IMAGE) $@ ::/bin/user
Note: See TracBrowser for help on using the repository browser.