source: trunk/Makefile @ 635

Last change on this file since 635 was 633, checked in by alain, 5 years ago

cosmetic

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