Advertisement
neilp1

SPL makefile

Oct 30th, 2011
328
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.86 KB | None | 0 0
  1. ########################################################################
  2. #
  3. # SPL, the Shakespeare Programming Language
  4. #
  5. # Copyright (C) 2001 Karl Hasselström and Jon Åslund
  6. #
  7. # This program is free software; you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation; either version 2 of the License, or (at
  10. # your option) any later version.
  11. #
  12. # This program is distributed in the hope that it will be useful, but
  13. # WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. # General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU General Public License
  18. # along with this program; if not, write to the Free Software
  19. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  20. # USA.
  21. #
  22. ########################################################################
  23.  
  24. NAME = spl
  25. VERSION = 1.2.1
  26. DISTNAME = $(NAME)-$(VERSION)
  27.  
  28. # compiler commands
  29. AR = ar
  30. CC = gcc
  31. LEX = flex
  32. RANLIB = ranlib
  33. TAR = tar
  34. YACC = bison
  35.  
  36. INCLUDEPATH = include
  37. EDITORPATH = editor
  38. EXAMPLEPATH = examples
  39.  
  40. # source / outputs
  41. MAKESCANNERINCLUDE = $(wildcard $(INCLUDEPATH)/*.{wordlist,metaflex})
  42.  
  43. # compiler flags
  44. YACCFLAGS = --verbose
  45. CCFLAGS = -O2 -Wall -LC:/Users/Neil/Downloads/Exes/flex-2.5.4a-1-bin
  46. LEXFLAGS = -Cem
  47.  
  48. .PHONY: all clean examples install libspl tar
  49. all: install examples
  50.  
  51. examples: install
  52. $(MAKE) -C $(EXAMPLEPATH) all
  53.  
  54. grammar.tab.h grammar.tab.c: grammar.y
  55. $(YACC) $(YACCFLAGS) -d $<
  56.  
  57. grammar.tab.o: grammar.tab.c grammar.tab.h telma.h
  58. $(CC) $(CCFLAGS) -c $<
  59.  
  60. install: spl2c libspl.a spl.h
  61. mkdir -p spl/bin spl/include spl/lib
  62. cp -pf spl2c spl/bin
  63. cp -pf spl.h spl/include
  64. cp -pf libspl.a spl/lib
  65.  
  66. libspl.a: libspl.o strutils.o
  67. $(AR) rc $@ $^
  68. $(RANLIB) $@
  69.  
  70. libspl.o: libspl.c spl.h
  71. $(CC) $(CCFLAGS) -c $<
  72.  
  73. makescanner: makescanner.o
  74. $(CC) $< $(CCFLAGS) -o $@
  75.  
  76. makescanner.o: makescanner.c
  77. $(CC) $(CCFLAGS) -c $<
  78.  
  79. scanner.c: scanner.l
  80. $(LEX) $(LEXFLAGS) -t $< > $@
  81.  
  82. scanner.l: makescanner $(MAKESCANNERINCLUDE)
  83. $< $(INCLUDEPATH) > $@ #remove ./
  84.  
  85. scanner.o: scanner.c grammar.tab.h telma.h
  86. $(CC) $(CCFLAGS) -c $<
  87.  
  88. spl2c: grammar.tab.o scanner.o strutils.o
  89. $(CC) $^ $(CCFLAGS) -lfl -o $@
  90.  
  91. strutils.o: strutils.c strutils.h
  92. $(CC) $(CCFLAGS) -c $<
  93.  
  94. tar: clean
  95. mkdir -p $(DISTNAME)
  96. cp `find . -type f -maxdepth 1` $(DISTNAME)
  97. cp -r $(INCLUDEPATH) $(DISTNAME)
  98. cp -r $(EDITORPATH) $(DISTNAME)
  99. cp -r $(EXAMPLEPATH) $(DISTNAME)
  100. $(TAR) zcvf $(DISTNAME).tar.gz $(DISTNAME)
  101.  
  102. # clean-up funtion
  103. clean:
  104. rm -f *~ $(EDITORPATH)/*~ $(INCLUDEPATH)/*~ *.l *.o *.a core grammar.output grammar.tab.h grammar.tab.c scanner.c makescanner spl2c *.tar.gz
  105. rm -rf spl $(DISTNAME)
  106. $(MAKE) -C $(EXAMPLEPATH) clean
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement