source: trunk/Makefile @ 660

Last change on this file since 660 was 657, checked in by alain, 4 years ago

Introduce remote_buf.c/.h & socket.c/.h files.
Update dev_nic.c/.h files.

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