source: trunk/Makefile @ 671

Last change on this file since 671 was 668, checked in by alain, 3 years ago

typos...

File size: 9.3 KB
Line 
1#############################################################################
2#                         ALMOS-MKH Global Makefile                         #
3#############################################################################
4
5-include params-soft.mk
6
7ifeq ($(ARCH_NAME),)
8$(error Please define ARCH_NAME parameter in params-soft.mk!)
9endif
10
11-include params-hard.mk
12
13# Default values for hardware parameters.
14# These parameters should be defined in the 'params-hard.mk' file.
15ARCH        ?= /users/alain/soc/tsar-trunk-svn-2013/platforms/tsar_generic_iob
16X_SIZE      ?= 2
17Y_SIZE      ?= 2
18NB_PROCS    ?= 2
19NB_TTYS     ?= 3
20IOC_TYPE    ?= IOC_BDV
21TXT_TYPE    ?= TXT_TTY
22FBF_TYPE    ?= FBF_SCL
23SYS_CLK     ?= 50000
24
25# Checking hardware platform definition.
26ifeq ($(wildcard $(ARCH)),)
27$(error Please define in ARCH parameter the path to the hardware platform!)
28endif
29
30# Rules that don't build target files
31# always out-of-date, need to be regenerated everytime they are called
32.PHONY: compile                                  \
33        hard_config.h                        \
34                dirs                                             \
35                list                                             \
36                extract                                          \
37                fsck                                             \
38                clean                                            \
39                build_libs                           \
40                build-disk                                       \
41                $(BOOTLOADER_PATH)/build/boot.elf    \
42                kernel/build/kernel.elf              \
43                user/init/build/init.elf             \
44                user/ksh/build/ksh.elf               \
45                user/pgdc/build/pgcd.elf             \
46                user/idbg/build/idbg.elf             \
47                user/sort/build/sort.elf             \
48        user/fft/build/fft.elf               \
49        user/display/build/display.elf       \
50        user/convol/build/convol.elf         \
51        user/transpose/build/transpose.elf   \
52        user/kleenex/build/kleenex.elf       \
53        user/tcp_server/build/tcp_server.elf \
54        user/tcp_client/build/tcp_client.elf
55 
56# Virtual disk path
57DISK_IMAGE      := hdd/virt_hdd.dmg
58
59# The Mtools used to build the FAT32 disk image perfom a few sanity checks, to
60# make sure that the disk is indeed an MS-DOS disk. However, the size of the
61# disk image used by ALMOS-MKH is not MS-DOS compliant.
62# Setting this variable prevents these checks.
63MTOOLS_SKIP_CHECK := 1
64
65##########################################################################################
66# Rule to generate boot.elf, kernel.elf, all user.elf files, and update the virtual disk
67# when the corresponding sources files have been modified or destroyed.
68# The "home" directory on the virtual disk is not modified
69compile: dirs                                 \
70         hard_config.h                        \
71         build_libs                           \
72         $(BOOTLOADER_PATH)/build/boot.elf    \
73         kernel/build/kernel.elf              \
74         user/init/build/init.elf             \
75         user/ksh/build/ksh.elf               \
76         user/pgcd/build/pgcd.elf             \
77         user/idbg/build/idbg.elf             \
78         user/sort/build/sort.elf             \
79         user/fft/build/fft.elf               \
80         user/display/build/display.elf       \
81         user/convol/build/convol.elf         \
82         user/transpose/build/transpose.elf   \
83         user/kleenex/build/kleenex.elf       \
84         user/tcp_server/build/tcp_server.elf \
85         user/tcp_client/build/tcp_client.elf \
86         list
87
88# Rule to create the hdd directory
89dirs:
90        @mkdir -p hdd
91
92# Rule to make a recursive list of the virtual disk content.
93list:
94        mdir -/ -b -i $(DISK_IMAGE) ::/
95
96##############################################################
97# Rule to copy the files generated by the virtual prototype
98# from the virtual disk 'home' directory to the current directory.
99extract:
100        mcopy -o -i $(DISK_IMAGE) ::/home .
101
102##############################################################
103# Rules to delete all binary files from Unix File System
104# without modifying the virtual disk.
105clean:
106        rm -f hard_config.h arch_info.xml arch_info.bin
107        rm -rf build
108        $(MAKE) -C kernel clean
109        $(MAKE) -C $(BOOTLOADER_PATH) clean
110        $(MAKE) -C $(LIBC_PATH) clean
111        $(MAKE) -C $(LIBPTHREAD_PATH) clean
112        $(MAKE) -C $(LIBSEMAPHORE_PATH) clean
113        $(MAKE) -C $(LIBALMOSMKH_PATH) clean
114        $(MAKE) -C $(LIBMATH_PATH) clean
115        $(MAKE) -C user/init clean
116        $(MAKE) -C user/ksh clean
117        $(MAKE) -C user/sort clean
118        $(MAKE) -C user/pgcd clean
119        $(MAKE) -C user/idbg clean
120        $(MAKE) -C user/fft clean
121        $(MAKE) -C user/display clean
122        $(MAKE) -C user/convol clean
123        $(MAKE) -C user/kleenex clean
124        $(MAKE) -C user/transpose clean
125        $(MAKE) -C user/tcp_server clean
126        $(MAKE) -C user/tcp_client clean
127        $(MAKE) -C $(HAL_ARCH) clean
128
129####################################################   
130# Rule for building a new virtual disk from scratch.
131# It creates the bin, bin/kernel, bin/user, and home directories.
132# This requires the generic Linux/MacOS 'create_dmg' script, that should be
133# placed in the same directory as this Makefile.
134build_disk: dirs
135        rm -f $(DISK_IMAGE)
136        ./create_dmg    create $(basename $(DISK_IMAGE))
137        dd              if=$(DISK_IMAGE) of=temp.dmg count=131072
138        mv              temp.dmg $(DISK_IMAGE)
139        mmd             -o -i $(DISK_IMAGE) ::/bin                            || true
140        mmd             -o -i $(DISK_IMAGE) ::/bin/kernel                     || true
141        mmd             -o -i $(DISK_IMAGE) ::/bin/user                       || true
142        mmd             -o -i $(DISK_IMAGE) ::/home                           || true
143        mmd             -o -i $(DISK_IMAGE) ::/misc                           || true 
144        mcopy           -o -i $(DISK_IMAGE) images/lena_256.raw ::/misc       || true             
145        mcopy           -o -i $(DISK_IMAGE) images/images_128.raw ::/misc     || true             
146        mcopy           -o -i $(DISK_IMAGE) images/philips_1024.raw ::/misc   || true             
147        mcopy           -o -i $(DISK_IMAGE) images/couple_512.raw ::/misc     || true             
148        mcopy           -o -i $(DISK_IMAGE) images/wood_32.raw ::/misc        || true             
149        mcopy           -o -i $(DISK_IMAGE) images/door_32.raw ::/misc        || true             
150        mcopy           -o -i $(DISK_IMAGE) images/rock_32.raw ::/misc        || true             
151        mcopy           -o -i $(DISK_IMAGE) images/handle_32.raw ::/misc      || true             
152        mdir                -/ -b -i $(DISK_IMAGE) ::/
153
154##############################################################
155# Rules to generate hardware description files (hard_config.h,
156# arch_info.bin and arch_info.xml), and update the virtual disk.
157hard_config.h: $(ARCH)/arch_info.py
158        tools/arch_info/genarch.py      --arch=$(ARCH)  \
159                                        --x_size=$(X_SIZE)              \
160                                        --y_size=$(Y_SIZE)              \
161                                        --nb_cores=$(NB_PROCS)      \
162                                        --nb_ttys=$(NB_TTYS)        \
163                                        --ioc_type=$(IOC_TYPE)      \
164                    --txt_type=$(TXT_TYPE)      \
165                    --fbf_type=$(FBF_TYPE)      \
166                    --sys_clk=$(SYS_CLK)        \
167                                        --hard=.                            \
168                                        --bin=.                             \
169                                        --xml=.                                 
170        mcopy -o -i $(DISK_IMAGE) arch_info.bin ::/   || true
171        mdir             -/ -b -i $(DISK_IMAGE) ::/
172
173############################################
174# Rules to generate the user level libraries
175build_libs: build_hal
176        $(MAKE) -C $(LIBALMOSMKH_PATH) headers
177        $(MAKE) -C $(LIBPTHREAD_PATH) headers
178        $(MAKE) -C $(LIBSEMAPHORE_PATH) headers
179        $(MAKE) -C $(LIBMATH_PATH) headers
180        $(MAKE) -C $(LIBC_PATH)
181        $(MAKE) -C $(LIBALMOSMKH_PATH)
182        $(MAKE) -C $(LIBPTHREAD_PATH)
183        $(MAKE) -C $(LIBSEMAPHORE_PATH) 
184        $(MAKE) -C $(LIBMATH_PATH) 
185
186#####################################################################
187# Rule to generate boot.elf and place it in sector #2 of virtual disk
188$(BOOTLOADER_PATH)/build/boot.elf:
189        $(MAKE) -C $(BOOTLOADER_PATH)
190        dd if=$@ of=$(DISK_IMAGE) seek=2 conv=notrunc
191
192######################################################
193# Rule to generate HAL objects (depending on HAL_ARCH)
194build_hal:
195        $(MAKE) -C $(HAL_ARCH)
196
197#############################################################
198# Rule to generate kernel.elf and place it on virtual disk
199kernel/build/kernel.elf: build_hal
200        $(MAKE) -C kernel/
201        mcopy -o -i $(DISK_IMAGE) $@ ::/bin/kernel
202
203#####################################################
204# Rules to generate user.elf and copy on virtual disk
205user/init/build/init.elf: build_libs
206        $(MAKE) -C user/init
207        mcopy -o -i $(DISK_IMAGE) $@ ::/bin/user
208user/ksh/build/ksh.elf: build_libs
209        $(MAKE) -C user/ksh
210        mcopy -o -i $(DISK_IMAGE) $@ ::/bin/user
211user/pgcd/build/pgcd.elf: build_libs
212        $(MAKE) -C user/pgcd
213        mcopy -o -i $(DISK_IMAGE) $@ ::/bin/user
214user/idbg/build/idbg.elf: build_libs
215        $(MAKE) -C user/idbg
216        mcopy -o -i $(DISK_IMAGE) $@ ::/bin/user
217user/sort/build/sort.elf: build_libs
218        $(MAKE) -C user/sort
219        mcopy -o -i $(DISK_IMAGE) $@ ::/bin/user
220user/fft/build/fft.elf: build_libs
221        $(MAKE) -C user/fft
222        mcopy -o -i $(DISK_IMAGE) $@ ::/bin/user
223user/display/build/display.elf: build_libs
224        $(MAKE) -C user/display
225        mcopy -o -i $(DISK_IMAGE) $@ ::/bin/user
226user/convol/build/convol.elf: build_libs
227        $(MAKE) -C user/convol
228        mcopy -o -i $(DISK_IMAGE) $@ ::/bin/user
229user/kleenex/build/kleenex.elf: build_libs
230        $(MAKE) -C user/kleenex
231        mcopy -o -i $(DISK_IMAGE) $@ ::/bin/user
232user/transpose/build/transpose.elf: build_libs
233        $(MAKE) -C user/transpose
234        mcopy -o -i $(DISK_IMAGE) $@ ::/bin/user
235user/tcp_server/build/tcp_server.elf: build_libs
236        $(MAKE) -C user/tcp_server
237        mcopy -o -i $(DISK_IMAGE) $@ ::/bin/user
238user/tcp_client/build/tcp_client.elf: build_libs
239        $(MAKE) -C user/tcp_client
240        mcopy -o -i $(DISK_IMAGE) $@ ::/bin/user
Note: See TracBrowser for help on using the repository browser.