source: trunk/Makefile @ 648

Last change on this file since 648 was 647, checked in by alain, 4 years ago

...miscelaneous...

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