Changeset 776 for soft/giet_vm/Makefile


Ignore:
Timestamp:
Feb 4, 2016, 5:20:26 PM (9 years ago)
Author:
alain
Message:

Modify Makefile to avoid to rebuild the disk image each time an executable is compiled,
because we want to use the virtual disk as a non volatile external storage.

  • use "make clean-disk" to delete all binary files AND delete the disk image.
  • Use "make clean" to delete all binary files WITHOUT deleting the existing disk-image.
  • use "make" to regenerate all executables whose source code has been modified AND update the disk-image.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/Makefile

    r772 r776  
    2828                 applications/convol/convol.py          \
    2929                 applications/coproc/coproc.py          \
     30                 applications/coremark/coremark.py      \
    3031                 applications/display/display.py        \
    3132                 applications/dhrystone/dhrystone.py    \
     
    3435                 applications/ocean/ocean.py            \
    3536                 applications/raycast/raycast.py        \
     37                 applications/rosenfeld/rosenfeld.py    \
    3638                 applications/router/router.py          \
    37                  applications/rosenfeld/rosenfeld.py    \
    3839                 applications/shell/shell.py            \
    3940                 applications/sort/sort.py              \
    40                  applications/transpose/transpose.py    \
    41                  applications/coremark/coremark.py
    42 
    43 # build the list of applications to be executed (used in the all rule)
     41                 applications/transpose/transpose.py
     42
     43
     44# build the list of applications to be executed (used in the "compile" rule)
    4445APPLIS_ELF    := $(addsuffix /appli.elf,$(addprefix applications/,$(APPLIS)))
    4546
     
    5354
    5455### Rules that don't build a target file
    55 .PHONY: all dirs list extract clean clean-disk install-disk $(APPLIS_ELF)
     56.PHONY: compil \
     57        dirs \
     58        list \
     59        extract \
     60        clean \
     61        clean-disk \
     62        build/kernel/kernel.elf \
     63        build/boot/boot.elf \
     64        $(APPLIS_ELF)
    5665
    5766### Objects to be linked for the drivers library
     
    133142
    134143CFLAGS = -Wall -ffreestanding -mno-gpopt -mips32 -g -O2 \
    135                  -fno-delete-null-pointer-checks $(XCFLAGS)
     144                 -fno-delete-null-pointer-checks
    136145
    137146GIET_INCLUDE = -Igiet_boot    \
     
    150159### of the disk image used by the Giet-VM is not MS-DOS compliant.
    151160### Setting this variable prevents these checks.
     161
    152162MTOOLS_SKIP_CHECK := 1
    153163
    154164##################################
    155 ### first rule executed (make all)
    156 all: dirs                            \
    157      install-disk
     165### first rule executed
     166### compile boot.elf, kernel.elf, and selected appli.elf
     167### update these .elf files on virtual disk
     168compile: dirs                    \
     169         hard_config.h           \
     170         build/kernel/kernel.elf \
     171         build/boot/boot.elf     \
     172         $(APPLIS_ELF)         
    158173        mdir -/ -b -i $(DISK_IMAGE) ::/
    159174
    160 #####################################################
    161 ### create build directories
     175########################################
     176### create build directories for giet_vm
    162177dirs:
    163178        @mkdir -p build/boot
     
    174189         mdir -/ -w -i $(DISK_IMAGE) ::/
    175190
     191#####################################################
     192### make a file system check for the the virtual disk
     193fsck:
     194         fsck_msdos $(DISK_IMAGE)
     195
    176196########################################################
    177197### copy the files generated by the virtual prototype on
    178 ### the virtual disk "home" directory to the giet_vm home directory
     198### the virtual disk "home" directory to the current directory
    179199extract:
    180200        mcopy -o -i $(DISK_IMAGE) ::/home .
    181201
    182 ########################################
    183 ### clean all binary files
     202####################################################
     203### delete all binary files from Unix File System
     204### but does NOT modify the virtual disk
    184205clean:
    185206        rm -f *.o *.elf *.bin *.txt core
     
    189210        cd applications/convol       && $(MAKE) clean && cd ../..
    190211        cd applications/coproc       && $(MAKE) clean && cd ../..
     212        cd applications/coremark     && $(MAKE) clean && cd ../..
    191213        cd applications/display      && $(MAKE) clean && cd ../..
    192214        cd applications/dhrystone    && $(MAKE) clean && cd ../..
     
    195217        cd applications/ocean        && $(MAKE) clean && cd ../..
    196218        cd applications/raycast      && $(MAKE) clean && cd ../..
     219        cd applications/rosenfeld    && $(MAKE) clean && cd ../..
    197220        cd applications/router       && $(MAKE) clean && cd ../..
    198         cd applications/rosenfeld    && $(MAKE) clean && cd ../..
    199221        cd applications/shell        && $(MAKE) clean && cd ../..
    200222        cd applications/sort         && $(MAKE) clean && cd ../..
    201223        cd applications/transpose    && $(MAKE) clean && cd ../..
    202         cd applications/coremark     && $(MAKE) clean && cd ../..
    203 
    204 ########################################
    205 ### delete disk image
    206 clean-disk:
    207         rm -rf $(DISK_IMAGE)
    208 
    209 ########################################
    210 ### Copy content in the disk image
    211 ### create the three build / misc / home directories
    212 ### store the images files into misc
    213 install-disk: $(DISK_IMAGE) build/kernel/kernel.elf $(APPLIS_ELF)
    214         mmd -o -i $< ::/bin               || true
    215         mmd -o -i $< ::/bin/kernel        || true
    216         mmd -o -i $< ::/bin/classif       || true
    217         mmd -o -i $< ::/bin/convol        || true
    218         mmd -o -i $< ::/bin/coproc        || true
    219         mmd -o -i $< ::/bin/dhrystone     || true
    220         mmd -o -i $< ::/bin/display       || true
    221         mmd -o -i $< ::/bin/gameoflife    || true
    222         mmd -o -i $< ::/bin/mjpeg         || true
    223         mmd -o -i $< ::/bin/ocean         || true
    224         mmd -o -i $< ::/bin/raycast       || true
    225         mmd -o -i $< ::/bin/router        || true
    226         mmd -o -i $< ::/bin/rosenfeld     || true
    227         mmd -o -i $< ::/bin/shell         || true
    228         mmd -o -i $< ::/bin/sort          || true
    229         mmd -o -i $< ::/bin/transpose     || true
    230         mmd -o -i $< ::/bin/coremark      || true
    231         mmd -o -i $< ::/misc              || true
    232         mmd -o -i $< ::/home              || true
    233         mcopy -o -i $< map.bin ::/
    234         mcopy -o -i $< build/kernel/kernel.elf ::/bin/kernel
    235         mcopy -o -i $< applications/classif/appli.elf ::/bin/classif          || true
    236         mcopy -o -i $< applications/convol/appli.elf ::/bin/convol            || true
    237         mcopy -o -i $< applications/coproc/appli.elf ::/bin/coproc            || true
    238         mcopy -o -i $< applications/dhrystone/appli.elf ::/bin/dhrystone      || true
    239         mcopy -o -i $< applications/display/appli.elf ::/bin/display          || true
    240         mcopy -o -i $< applications/gameoflife/appli.elf ::/bin/gameoflife    || true
    241         mcopy -o -i $< applications/mjpeg/appli.elf ::/bin/mjpeg              || true
    242         mcopy -o -i $< applications/ocean/appli.elf ::/bin/ocean              || true
    243         mcopy -o -i $< applications/raycast/appli.elf ::/bin/raycast          || true
    244         mcopy -o -i $< applications/router/appli.elf ::/bin/router            || true
    245         mcopy -o -i $< applications/rosenfeld/appli.elf ::/bin/rosenfeld      || true
    246         mcopy -o -i $< applications/shell/appli.elf ::/bin/shell              || true
    247         mcopy -o -i $< applications/sort/appli.elf ::/bin/sort                || true
    248         mcopy -o -i $< applications/transpose/appli.elf ::/bin/transpose      || true
    249         mcopy -o -i $< applications/coremark/appli.elf ::/bin/coremark        || true
    250         mcopy -o -i $< images/images_128.raw ::/misc
    251         mcopy -o -i $< images/philips_1024.raw ::/misc
    252         mcopy -o -i $< images/lena_256.raw ::/misc
    253         mcopy -o -i $< images/bridge_256.raw ::/misc
    254         mcopy -o -i $< images/couple_512.raw ::/misc
    255         mcopy -o -i $< images/door_32.raw ::/misc
    256         mcopy -o -i $< images/handle_32.raw ::/misc
    257         mcopy -o -i $< images/rock_32.raw ::/misc
    258         mcopy -o -i $< images/wood_32.raw ::/misc
    259         mcopy -o -i $< images/wood_32.raw ::/misc
    260         mcopy -o -i $< images/plan_48.mjpg ::/misc
    261         mcopy -o -i $< images/mandel_128.mjpg ::/misc
    262         mcopy -o -i $< images/video_160_120.mjpg ::/misc
    263 
    264 #########################
    265 ### Disk image generation
     224
     225#####################################################
     226### delete all binary files from Unix File System
     227### and build a new virtual disk :
     228### - create the bin / misc / home directories
     229### - create applications sub-directories
     230### - store various files into misc
    266231### This requires the generic LINUX/MacOS script "create_dmg" script
    267232### written by C.Fuguet. (should be installed in GIET-VM root directory).
    268 $(DISK_IMAGE): build/boot/boot.elf
    269         rm -f $@
    270         ./create_dmg create $(basename $@)
    271         dd if=$@ of=temp.dmg count=65536
    272         mv temp.dmg $@
    273         dd if=build/boot/boot.elf of=$@ seek=2 conv=notrunc
     233clean-disk: clean
     234        rm -f $(DISK_IMAGE)
     235        ./create_dmg create $(basename $(DISK_IMAGE))
     236        dd if=$(DISK_IMAGE) of=temp.dmg count=65536
     237        mv temp.dmg $(DISK_IMAGE)
     238        mmd -o -i $(DISK_IMAGE) ::/bin               || true
     239        mmd -o -i $(DISK_IMAGE) ::/bin/kernel        || true
     240        mmd -o -i $(DISK_IMAGE) ::/bin/classif       || true
     241        mmd -o -i $(DISK_IMAGE) ::/bin/convol        || true
     242        mmd -o -i $(DISK_IMAGE) ::/bin/coproc        || true
     243        mmd -o -i $(DISK_IMAGE) ::/bin/coremark      || true
     244        mmd -o -i $(DISK_IMAGE) ::/bin/dhrystone     || true
     245        mmd -o -i $(DISK_IMAGE) ::/bin/display       || true
     246        mmd -o -i $(DISK_IMAGE) ::/bin/gameoflife    || true
     247        mmd -o -i $(DISK_IMAGE) ::/bin/mjpeg         || true
     248        mmd -o -i $(DISK_IMAGE) ::/bin/ocean         || true
     249        mmd -o -i $(DISK_IMAGE) ::/bin/raycast       || true
     250        mmd -o -i $(DISK_IMAGE) ::/bin/rosenfeld     || true
     251        mmd -o -i $(DISK_IMAGE) ::/bin/router        || true
     252        mmd -o -i $(DISK_IMAGE) ::/bin/shell         || true
     253        mmd -o -i $(DISK_IMAGE) ::/bin/sort          || true
     254        mmd -o -i $(DISK_IMAGE) ::/bin/transpose     || true
     255        mmd -o -i $(DISK_IMAGE) ::/misc              || true
     256        mmd -o -i $(DISK_IMAGE) ::/home              || true
     257        mcopy -o -i $(DISK_IMAGE) images/images_128.raw ::/misc
     258        mcopy -o -i $(DISK_IMAGE) images/philips_1024.raw ::/misc
     259        mcopy -o -i $(DISK_IMAGE) images/lena_256.raw ::/misc
     260        mcopy -o -i $(DISK_IMAGE) images/bridge_256.raw ::/misc
     261        mcopy -o -i $(DISK_IMAGE) images/couple_512.raw ::/misc
     262        mcopy -o -i $(DISK_IMAGE) images/door_32.raw ::/misc
     263        mcopy -o -i $(DISK_IMAGE) images/handle_32.raw ::/misc
     264        mcopy -o -i $(DISK_IMAGE) images/rock_32.raw ::/misc
     265        mcopy -o -i $(DISK_IMAGE) images/wood_32.raw ::/misc
     266        mcopy -o -i $(DISK_IMAGE) images/wood_32.raw ::/misc
     267        mcopy -o -i $(DISK_IMAGE) images/plan_48.mjpg ::/misc
     268        mcopy -o -i $(DISK_IMAGE) images/mandel_128.mjpg ::/misc
     269        mcopy -o -i $(DISK_IMAGE) images/video_160_120.mjpg ::/misc
     270        mdir -/ -b -i $(DISK_IMAGE) ::/
    274271
    275272#########################################################################
    276273### mapping generation: map.bin / map.xml / hard_config.h / giet_vsegs.ld
     274### update map.bin on virtual disk
    277275hard_config.h: $(ARCH)/arch.py $(APPLIS_PY)
    278276        giet_python/genmap --arch=$(ARCH)     \
     
    287285                       $(GENMAP_APPLIS)   \
    288286                       --xml=.
     287        mcopy -o -i $(DISK_IMAGE) map.bin ::/      || true
    289288
    290289################################
     
    315314        $(CC) $(GIET_INCLUDE) $(CFLAGS)  -c -o $@ $<
    316315
    317 ########################
     316##########################
    318317### boot compilation
    319 ### Copy bootloader into sector 2 of disk image
     318### Copy boot.elf into sector 2 of disk image
    320319build/boot/boot.elf: $(BOOT_OBJS)            \
    321320                     giet_boot/boot.ld       \
     
    323322        $(LD) -o $@ -T giet_boot/boot.ld $(BOOT_OBJS) -Lbuild/drivers -ldrivers
    324323        $(DU) -D $@ > $@.txt
     324        dd if=build/boot/boot.elf of=$(DISK_IMAGE) seek=2 conv=notrunc
     325   
    325326
    326327build/boot/boot.o: giet_boot/boot.c          \
     
    336337        $(CC) $(GIET_INCLUDE) $(CFLAGS)  -c -o $@ $<
    337338
    338 #########################
    339 ### kernel compilation
     339##########################
     340### kernel.elf compilation
     341### update kernel.elf on virtual disk
    340342build/kernel/kernel.elf: $(KERNEL_OBJS)        \
    341343                         giet_kernel/kernel.ld \
     
    343345        $(LD) -o $@ -T giet_kernel/kernel.ld $(KERNEL_OBJS) -Lbuild/drivers -ldrivers
    344346        $(DU) -D $@ > $@.txt
     347        mdel -i $(DISK_IMAGE) ::/bin/kernel/kernel.elf   || true
     348        mcopy -i $(DISK_IMAGE) build/kernel/kernel.elf ::/bin/kernel
    345349
    346350build/kernel/%.o: giet_kernel/%.c    \
     
    354358        $(CC) $(GIET_INCLUDE) $(CFLAGS)  -c -o $@ $<
    355359
    356 ###########################
     360############################
    357361### user library compilation
    358362build/libs/%.o: giet_libs/%.c        \
     
    365369        $(AR) -rcs $@ $^
    366370
    367 ################################
     371############################
    368372### math library compilation
    369373build/libs/math/%.o: giet_libs/math/%.c             \
     
    375379        $(AR) -rcs $@ $^
    376380
    377 ########################################
     381#####################################
    378382### classif   application compilation
     383### update classif/appli.elf on virtual disk
    379384applications/classif/appli.elf: build/libs/libuser.a
    380385        $(MAKE) -C applications/classif
    381 
    382 ########################################
     386        mdel -i $(DISK_IMAGE) ::/bin/classif/appli.elf   || true
     387        mcopy -o -i $(DISK_IMAGE) applications/classif/appli.elf ::/bin/classif
     388
     389
     390####################################
    383391### convol   application compilation
     392### update convol/appli.elf on virtual disk
    384393applications/convol/appli.elf: build/libs/libuser.a
    385394        $(MAKE) -C applications/convol
     395        mdel -i $(DISK_IMAGE) ::/bin/convol/appli.elf  || true
     396        mcopy -o -i $(DISK_IMAGE) applications/convol/appli.elf ::/bin/convol
    386397
    387398########################################
    388399### coproc   application compilation
     400### update coproc/appli.elf on virtual disk
    389401applications/coproc/appli.elf: build/libs/libuser.a
    390402        $(MAKE) -C applications/coproc
    391 
    392 ########################################
    393 ### dhrystone   application compilation
    394 applications/dhrystone/appli.elf: build/libs/libuser.a
    395         $(MAKE) -C applications/dhrystone
    396 
    397 ########################################
    398 ### display  application compilation
    399 applications/display/appli.elf: build/libs/libuser.a
    400         $(MAKE) -C applications/display
    401 
    402 ########################################
    403 ### gameoflife  application compilation
    404 applications/gameoflife/appli.elf: build/libs/libuser.a
    405         $(MAKE) -C applications/gameoflife
    406 
    407 ########################################
    408 ### mjpeg  application compilation
    409 applications/mjpeg/appli.elf: build/libs/libuser.a
    410         $(MAKE) -C applications/mjpeg
    411 
    412 ########################################
    413 ### ocean  application compilation
    414 applications/ocean/appli.elf: build/libs/libmath.a  build/libs/libuser.a
    415         cd applications/ocean && $(MAKE) && cd ../..
    416 
    417 ########################################
    418 ### raycast application compilation
    419 applications/raycast/appli.elf: build/libs/libmath.a build/libs/libuser.a
    420         $(MAKE) -C applications/raycast
    421 
    422 ########################################
    423 ### router  application compilation
    424 applications/router/appli.elf: build/libs/libuser.a
    425         $(MAKE) -C applications/router
    426 
    427 ########################################
    428 ### rosenfeld application compilation
    429 applications/rosenfeld/appli.elf: build/libs/libmath.a build/libs/libuser.a
    430         $(MAKE) -C applications/rosenfeld
    431 
    432 ########################################
    433 ### shell  application compilation
    434 applications/shell/appli.elf: build/libs/libuser.a
    435         $(MAKE) -C applications/shell
    436 
    437 ########################################
    438 ### sort  application compilation
    439 applications/sort/appli.elf: build/libs/libuser.a
    440         $(MAKE) -C applications/sort
    441 
    442 ########################################
    443 ### transpose compilation
    444 applications/transpose/appli.elf: build/libs/libuser.a
    445         $(MAKE) -C applications/transpose
     403        mdel -i $(DISK_IMAGE) ::/bin/coproc/appli.elf  || true
     404        mcopy -o -i $(DISK_IMAGE) applications/coproc/appli.elf ::/bin/coproc
    446405
    447406########################################
     
    449408applications/coremark/appli.elf: build/libs/libuser.a
    450409        $(MAKE) -C applications/coremark
    451 
     410        mdel -i $(DISK_IMAGE) ::/bin/coremark/appli.elf  || true
     411        mcopy -o -i $(DISK_IMAGE) applications/coremark/appli.elf ::/bin/coremark
     412
     413
     414########################################
     415### dhrystone   application compilation
     416### update dhrystone/appli.elf on virtual disk
     417applications/dhrystone/appli.elf: build/libs/libuser.a
     418        $(MAKE) -C applications/dhrystone
     419        mdel -i $(DISK_IMAGE) ::/bin/dhrystone/appli.elf  || true
     420        mcopy -o -i $(DISK_IMAGE) applications/dhtystone/appli.elf ::/bin/dhrystone
     421
     422########################################
     423### display  application compilation
     424### update display/appli.elf on virtual disk
     425applications/display/appli.elf: build/libs/libuser.a
     426        $(MAKE) -C applications/display
     427        mdel -i $(DISK_IMAGE) ::/bin/display/appli.elf   || true
     428        mcopy -o -i $(DISK_IMAGE) applications/display/appli.elf ::/bin/display
     429
     430########################################
     431### gameoflife  application compilation
     432### update gameoflife/appli.elf on virtual disk
     433applications/gameoflife/appli.elf: build/libs/libuser.a
     434        $(MAKE) -C applications/gameoflife
     435        mdel -i $(DISK_IMAGE) ::/bin/gameoflife/appli.elf   || true
     436        mcopy -o -i $(DISK_IMAGE) applications/gameoflife/appli.elf ::/bin/gameoflife
     437
     438########################################
     439### mjpeg  application compilation
     440### update mjpeg/appli.elf on virtual disk
     441applications/mjpeg/appli.elf: build/libs/libuser.a
     442        $(MAKE) -C applications/mjpeg
     443        mdel -i $(DISK_IMAGE) ::/bin/mjpeg/appli.elf   || true
     444        mcopy -o -i $(DISK_IMAGE) applications/mjpeg/appli.elf ::/bin/mjpeg
     445
     446########################################
     447### ocean  application compilation
     448### update ocean/appli.elf on virtual disk
     449applications/ocean/appli.elf: build/libs/libmath.a  build/libs/libuser.a
     450        cd applications/ocean && $(MAKE) && cd ../..
     451        mdel -i $(DISK_IMAGE) ::/bin/ocean/appli.elf   || true
     452        mcopy -o -i $(DISK_IMAGE) applications/ocean/appli.elf ::/bin/ocean
     453
     454########################################
     455### raycast application compilation
     456### update raycast/appli.elf on virtual disk
     457applications/raycast/appli.elf: build/libs/libmath.a build/libs/libuser.a
     458        $(MAKE) -C applications/raycast
     459        mdel -i $(DISK_IMAGE) ::/bin/raycast/appli.elf   || true
     460        mcopy -o -i $(DISK_IMAGE) applications/raycast/appli.elf ::/bin/raycast
     461
     462########################################
     463### rosenfeld  application compilation
     464### update rosenfeld/appli.elf on virtual disk
     465applications/rosenfeld/appli.elf: build/libs/libuser.a
     466        $(MAKE) -C applications/rosenfeld
     467        mdel -i $(DISK_IMAGE) ::/bin/rosenfeld/appli.elf   || true
     468        mcopy -o -i $(DISK_IMAGE) applications/rosenfeld/appli.elf ::/bin/router
     469
     470########################################
     471### router  application compilation
     472### update router/appli.elf on virtual disk
     473applications/router/appli.elf: build/libs/libuser.a
     474        $(MAKE) -C applications/router
     475        mdel -i $(DISK_IMAGE) ::/bin/router/appli.elf   || true
     476        mcopy -o -i $(DISK_IMAGE) applications/router/appli.elf ::/bin/router
     477
     478########################################
     479### shell  application compilation
     480### update shell/appli.elf on virtual disk
     481applications/shell/appli.elf: build/libs/libuser.a
     482        $(MAKE) -C applications/shell
     483        mdel -i $(DISK_IMAGE) ::/bin/shell/appli.elf   || true
     484        mcopy -o -i $(DISK_IMAGE) applications/shell/appli.elf ::/bin/shell
     485
     486########################################
     487### sort  application compilation
     488### update sort/appli.elf on virtual disk
     489applications/sort/appli.elf: build/libs/libuser.a
     490        $(MAKE) -C applications/sort
     491        mdel -i $(DISK_IMAGE) ::/bin/sort/appli.elf   || true
     492        mcopy -o -i $(DISK_IMAGE) applications/sort/appli.elf ::/bin/sort
     493
     494########################################
     495### transpose compilation
     496### update transpose/appli.elf on virtual disk
     497applications/transpose/appli.elf: build/libs/libuser.a
     498        $(MAKE) -C applications/transpose
     499        mdel -i $(DISK_IMAGE) ::/bin/transpose/appli.elf   || true
     500        mcopy -o -i $(DISK_IMAGE) applications/transpose/appli.elf ::/bin/transpose
     501
Note: See TracChangeset for help on using the changeset viewer.