source: trunk/Makefile @ 498

Last change on this file since 498 was 495, checked in by viala@…, 6 years ago

Minor: principal Makefile: Add cleaning libmath.

File size: 6.4 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        user/fft/build/fft.elf
46
47# Virtual disk path
48DISK_IMAGE      := hdd/virt_hdd.dmg
49
50# The Mtools used to build the FAT32 disk image perfom a few sanity checks, to
51# make sure that the disk is indeed an MS-DOS disk. However, the size of the
52# disk image used by ALMOS-MKH is not MS-DOS compliant.
53# Setting this variable prevents these checks.
54MTOOLS_SKIP_CHECK := 1
55
56# Rule to generate boot.elf, kernel.elf, all user.elf files, and update virtual disk.
57compile: dirs                              \
58         build_disk                        \
59         hard_config.h                     \
60         build_libs                        \
61         $(BOOTLOADER_PATH)/build/boot.elf \
62         kernel/build/kernel.elf           \
63         user/init/build/init.elf          \
64         user/ksh/build/ksh.elf            \
65         user/pgcd/build/pgcd.elf          \
66         user/idbg/build/idbg.elf          \
67         user/sort/build/sort.elf          \
68         user/fft/build/fft.elf           \
69         list
70
71# Rule to create the hdd directory
72dirs:
73        @mkdir -p hdd
74
75# Rule to make a recursive list of the virtual disk content.
76list:
77        mdir -/ -b -i $(DISK_IMAGE) ::/
78
79##############################################################
80# Rule to copy the files generated by the virtual prototype
81# from the virtual disk 'home' directory to the current directory.
82extract:
83        mcopy -o -i $(DISK_IMAGE) ::/home .
84
85# Rules to delete all binary files from Unix File System
86# without modifying the virtual disk.
87clean:
88        rm -f hard_config.h arch_info.xml arch_info.bin
89        rm -rf build
90        $(MAKE) -C kernel clean
91        $(MAKE) -C $(BOOTLOADER_PATH) clean
92        $(MAKE) -C $(LIBC_PATH) clean
93        $(MAKE) -C $(LIBPTHREAD_PATH) clean
94        $(MAKE) -C $(LIBSEMAPHORE_PATH) clean
95        $(MAKE) -C $(LIBALMOSMKH_PATH) clean
96        $(MAKE) -C $(LIBMATH_PATH) clean
97        $(MAKE) -C user/init clean
98        $(MAKE) -C user/ksh clean
99        $(MAKE) -C user/sort clean
100        $(MAKE) -C user/pgcd clean
101        $(MAKE) -C user/idbg clean
102        $(MAKE) -C user/fft clean
103        $(MAKE) -C $(HAL_ARCH) clean
104
105####################################################   
106# Rule for building a new virtual disk from scratch.
107# It creates the bin, bin/kernel, bin/user, and home directories.
108# This requires the generic Linux/MacOS 'create_dmg' script, that should be
109# placed in the same directory as this Makefile.
110build_disk: dirs
111        rm -f $(DISK_IMAGE)
112        ./create_dmg    create $(basename $(DISK_IMAGE))
113        dd                              if=$(DISK_IMAGE) of=temp.dmg count=65536
114        mv                              temp.dmg $(DISK_IMAGE)
115        mmd                     -o -i $(DISK_IMAGE) ::/bin         || true
116        mmd                     -o -i $(DISK_IMAGE) ::/bin/kernel  || true
117        mmd                     -o -i $(DISK_IMAGE) ::/bin/user    || true
118        mmd                     -o -i $(DISK_IMAGE) ::/home        || true
119        mdir             -/ -b -i $(DISK_IMAGE) ::/
120       
121##############################################################
122# Rules to generate hardware description files (hard_config.h,
123# arch_info.bin and arch_info.xml), and update the virtual disk.
124hard_config.h: build_disk $(ARCH)/arch_info.py
125        tools/arch_info/genarch.py      --arch=$(ARCH)                  \
126                                                                --x_size=$(X_SIZE)              \
127                                                                --y_size=$(Y_SIZE)              \
128                                                                --nb_cores=$(NB_PROCS)  \
129                                                                --nb_ttys=$(NB_TTYS)    \
130                                                                --fbf_size=$(FBF_WIDTH) \
131                                                                --ioc_type=$(IOC_TYPE)  \
132                                                                --hard=.                                \
133                                                                --bin=.                                 \
134                                                                --xml=.                                 
135        mcopy -o -i $(DISK_IMAGE) arch_info.bin ::/   || true
136        mdir             -/ -b -i $(DISK_IMAGE) ::/
137
138############################################
139# Rules to generate the user level libraries
140build_libs: build_hal
141        $(MAKE) -C $(LIBALMOSMKH_PATH) headers
142        $(MAKE) -C $(LIBPTHREAD_PATH) headers
143        $(MAKE) -C $(LIBSEMAPHORE_PATH) headers
144        $(MAKE) -C $(LIBMATH_PATH) headers
145        $(MAKE) -C $(LIBC_PATH)
146        $(MAKE) -C $(LIBALMOSMKH_PATH)
147        $(MAKE) -C $(LIBPTHREAD_PATH)
148        $(MAKE) -C $(LIBSEMAPHORE_PATH) 
149        $(MAKE) -C $(LIBMATH_PATH) 
150
151#####################################################################
152# Rule to generate boot.elf and place it in sector #2 of virtual disk
153$(BOOTLOADER_PATH)/build/boot.elf:
154        $(MAKE) -C $(BOOTLOADER_PATH)
155        dd if=$@ of=$(DISK_IMAGE) seek=2 conv=notrunc
156
157######################################################
158# Rule to generate HAL objects (depending on HAL_ARCH)
159build_hal:
160        $(MAKE) -C $(HAL_ARCH)
161
162#############################################################
163# Rule to generate kernel.elf and place it on virtual disk
164kernel/build/kernel.elf: build_hal
165        $(MAKE) -C kernel/
166        mcopy -o -i $(DISK_IMAGE) $@ ::/bin/kernel
167
168#####################################################
169# Rules to generate user.elf and copy on virtual disk
170user/init/build/init.elf: build_libs
171        $(MAKE) -C user/init
172        mcopy -o -i $(DISK_IMAGE) $@ ::/bin/user
173user/ksh/build/ksh.elf: build_libs
174        $(MAKE) -C user/ksh
175        mcopy -o -i $(DISK_IMAGE) $@ ::/bin/user
176user/pgcd/build/pgcd.elf: build_libs
177        $(MAKE) -C user/pgcd
178        mcopy -o -i $(DISK_IMAGE) $@ ::/bin/user
179user/idbg/build/idbg.elf: build_libs
180        $(MAKE) -C user/idbg
181        mcopy -o -i $(DISK_IMAGE) $@ ::/bin/user
182user/sort/build/sort.elf: build_libs
183        $(MAKE) -C user/sort
184        mcopy -o -i $(DISK_IMAGE) $@ ::/bin/user
185user/fft/build/fft.elf: build_libs
186        $(MAKE) -C user/fft
187        mcopy -o -i $(DISK_IMAGE) $@ ::/bin/user
Note: See TracBrowser for help on using the repository browser.