Skip to content

Commit

Permalink
- added a Makefile for MinGW and Linux.
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@5447 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adrpo committed May 4, 2010
1 parent 0dd18c2 commit 385a7f2
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 16 deletions.
26 changes: 26 additions & 0 deletions Parser/Makefile
@@ -0,0 +1,26 @@

all: libantlr3.a ModelicaLexer.c ModelicaParser.c ModelicaParser

libantlr3.a: antlr-3.2/runtime/C/src/* antlr-3.2/runtime/C/include/*
# build the library
gcc -O3 -c antlr-3.2/runtime/C/src/*.c -Iantlr-3.2/runtime/C/include
ar -ru libantlr3.a *.o
ranlib libantlr3.a
rm -f *.o

ModelicaLexer.c ModelicaParser.c: Modelica.g
./runantlr.sh

ModelicaParser: libantlr3.a ModelicaLexer.c ModelicaParser.c
gcc -O3 -o ModelicaParser *.c -I. -Iantlr-3.2/runtime/C/include -L. -lantlr3
mkdir -p Release
cp -f ModelicaParser Release/ModelicaParser

test: ModelicaParser
sh -c "time ./Release/ModelicaParser -f FullModelica3.1.mo"

clean:
rm -f *.o *.a ModelicaParser.c ModelicaParser.h ModelicaLexer.c ModelicaLexer.h ModelicaParser \
ModelicaParser.exe ./Release/ModelicaParser.exe ./Release/ModelicaParser


20 changes: 4 additions & 16 deletions Parser/README.txt
Expand Up @@ -2,28 +2,16 @@ A Lexer/Parser for Modelica based on ANTLR3.2
---------------------------------------------
Adrian Pop [adpo@ida.liu.se] 2010-05-04


Visual Studio:
1. Open ModelicaParser.sln and build the project.

2. To test the parser use -d for directories -f for files.
adrpo@KAFKA ~/dev/OpenModelica/Parser
$ time ./Release/ModelicaParser.exe -d ~/dev/OpenModelica/build/ModelicaLibrary/

$ time ./Release/ModelicaParser.exe -d ~/dev/OpenModelica/build/ModelicaLibrary/
adrpo@KAFKA ~/dev/OpenModelica/Parser
$ time ./Release/ModelicaParser.exe -f FullModelica3.1.mo

There are no Makefiles to build with MinGW or gcc yet, but is rather easy:
$ cd antlr-3.2/runtime/C/src
# build the library
$ gcc -c *.c -I../include
$ ar -ru libantrl3.a *.o
$ ranlib libantrl3.a
# get back to Parser directory
$ cd ../../../../
# genarate the parser code
$ ./runantlr.sh
# build the executable
$ gcc -o ModelicaParser *.c -Iantlr-3.2/runtime/C/include -Lantlr-3.2/runtime/C/src -lantlr3
MinGW GCC /Linux GCC
$ make clean all test

In the future antlr files will be moved to OMDev.

Expand Down

0 comments on commit 385a7f2

Please sign in to comment.