make.sh 693 B

123456789101112131415161718192021222324252627282930
  1. #!/bin/sh
  2. #
  3. # usage: ./make.sh PROGRAM FRONTEND
  4. # e.g.: ./make.sh minigames sdl
  5. PROGRAM=$1
  6. LINK=''
  7. DEF=''
  8. clear; clear;
  9. if [ $2 = "sdl" ]; then
  10. DEF='-DSAF_PLATFORM_SDL2=1'
  11. LINK='-lSDL2'
  12. elif [ $2 = "csfml" ]; then
  13. DEF='-DSAF_PLATFORM_CSFML=1'
  14. LINK='-lcsfml-graphics -lcsfml-window -lcsfml-system -lcsfml-audio'
  15. elif [ $2 = "x11" ]; then
  16. DEF='-DSAF_PLATFORM_X11=1'
  17. LINK='-lX11'
  18. elif [ $2 = "ncurses" ]; then
  19. DEF='-DSAF_PLATFORM_NCURSES=1'
  20. LINK='-lncurses'
  21. else
  22. echo "error: second parameter has to be frontend (sdl, csfml, x11, ...)"
  23. exit 1
  24. fi
  25. g++ -x c -g -std=c99 -O3 -fmax-errors=5 -pedantic -Wall -Wextra $DEF -lm -o ${PROGRAM} ${PROGRAM}.h $LINK && ./${PROGRAM}