Compilation C

Description du code

Script de compilation. Compilateur LSD010

Code source ou contenu du fichier

  1. #!/bin/bash
  2. # debug: -x
  3. echo "$USERNAME($UID) on $HOSTNAME [running $OSTYPE]"
  4. finalName='lsd10'
  5. echo "Compile $finalName code"
  6. clear
  7. cd source/
  8. echo ""
  9. echo -e "\033[33;40m"
  10. echo "Removing possible previous compiled files ..."
  11. rm lex.yy.c y.tab.c y.tab.h y.output 2>/dev/null
  12. rm *.o *~ 2>/dev/null
  13. echo "Cleaning executable file ..."
  14. rm $finalName 2>/dev/null
  15. echo ""
  16. echo ""
  17. echo "Compiling Yacc file ..."
  18. bison -dtyv lsd10.y &&
  19. echo ""
  20. echo ""
  21. echo "Compiling Lex file ..."
  22. flex lsd10.l &&
  23. #bison --yacc -d -v lsd10.y &&
  24. #gcc -g -ansi -pedantic -Wall *.c
  25. echo ""
  26. echo ""
  27. echo "Compiling C files ..."
  28. gcc -c *.c
  29. gcc -o $finalName *.o
  30. echo ""
  31. echo ""
  32. echo -e "\033[32;40mDone\033[00m"
  33. echo ""
  34. echo ""
  35. #echo "Press [Ctrl]+c to escape"
  36. #read

Autres extraits de codes en bash

English translation

You have asked to visit this site in English. For now, only the interface is translated, but not all the content yet.

If you want to help me in translations, your contribution is welcome. All you need to do is register on the site, and send me a message asking me to add you to the group of translators, which will give you the opportunity to translate the pages you want. A link at the bottom of each translated page indicates that you are the translator, and has a link to your profile.

Thank you in advance.

Document created the 05/10/2009, last modified the 28/10/2018
Source of the printed document:https://www.gaudry.be/en/sniplet-rf-lsd010/project/build.html

The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.