Skip to content

Commit

Permalink
Adrian Pop, 2006-02-26
Browse files Browse the repository at this point in the history
- compilation on Linux, Cygwin, MSVC works now from SVN. All tests are OK.
- big changes to compilation result structure:
  The compilation result has now the following structure:
build/bin             (omc, OMShell, OMNotebook, ptplot.jar, Compile.bat, Compile, doPlot.bat, doPlot, omc_helptext.txt)
build/include         (all the .h files from c_runtime)
build/lib             (all the lib* and libf2c/lib* files from c_runtime)
build/doc             (trunk/doc and Compiler/doc)
build/doc/testmodels  (all the trunk/Examples/*.* files)
---------------------------------------------
- the makefiles now copy the needed files to the above structure after compilation
- changed the rml files to use this structure when compiling, or plotting. 
- changed the rtest files to use the build structure when running tests
- changed the VC7 setup to use this structure when deploying
- changed mosh (changed its name to OMShell) to use this structure when running omc
- added an install to the root Makefile that installs in what was give to configure --prefix=path
  or just ./install if none given.

The usage of OPENMODELICAHOME changed in this way:
- OPENMODELICAHOME/bin is used when running omc or calling scripts or searching for omc_helptext.txt
- OPENMODELICAHOME/lib is given as -L to compilation scripts
- OPENMODELICAHOME/include is given as -I to compilation scripts

helptext.txt and interactive_api.txt moved to Compiler/doc/omc_helptext.txt or omc_interactive_api.txt

Updated all README* accordingly.

These changes will make easier to move source directories around and
arrange the SVN as we like because the runtime structure is not 
the same as the compilation structure anymore.
Also is easier to understand what is the result of a compilation
because all the needed files for running OMC are now in trunk/build 
and not all over the source tree.


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@2169 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adrpo committed Feb 26, 2006
1 parent b1d7f5f commit 4340d89
Show file tree
Hide file tree
Showing 21 changed files with 249 additions and 66 deletions.
9 changes: 4 additions & 5 deletions Compiler/Ceval.rml
Expand Up @@ -1539,7 +1539,7 @@ axiom ceval_interactive_functions (env, Exp.CALL(Absyn.IDENT("clear"),[],_,_),s
Settings.get_installation_directory_path => omhome &
System.trim(omhome,"\"") => omhome' &
System.path_delimiter => pd &
Util.string_append_list([cit,omhome',pd,"Compiler",pd,"scripts",pd,"doPlot",cit]) => plotCmd &
Util.string_append_list([cit,omhome',pd,"bin",pd,"doPlot",cit]) => plotCmd &
Util.string_append_list([pwd,pd,"tmpPlot.plt"]) => tmpPlotFile &
Values.write_ptolemyplot_dataset(tmpPlotFile,value,vars'',"Plot by OpenModelica")
=> res &
Expand Down Expand Up @@ -1585,7 +1585,7 @@ axiom ceval_interactive_functions (env, Exp.CALL(Absyn.IDENT("clear"),[],_,_),s
Settings.get_installation_directory_path => omhome &
System.trim(omhome,"\"") => omhome' &
System.path_delimiter => pd &
Util.string_append_list([cit,omhome',pd,"Compiler",pd,"scripts",pd,"doPlot",cit]) => plotCmd &
Util.string_append_list([cit,omhome',pd,"bin",pd,"doPlot",cit]) => plotCmd &
Util.string_append_list([pwd,pd,"tmpPlot.plt"]) => tmpPlotFile &
Values.write_ptolemyplot_dataset(tmpPlotFile,value,vars',"Plot by OpenModelica")
=> res &
Expand Down Expand Up @@ -1807,7 +1807,7 @@ axiom ceval_interactive_functions (env, Exp.CALL(Absyn.IDENT("clear"),[],_,_),s
System.trim(omhome,"\"") => omhome' &
win_citation() => cit &
System.path_delimiter => pd &
Util.string_append_list([omhome',pd,"Compiler",pd,"helptext.txt"]) => filename &
Util.string_append_list([omhome',pd,"bin",pd,"omc_helptext.txt"]) => filename &
print filename &
System.read_file(filename) => str
--------------------------
Expand Down Expand Up @@ -2176,8 +2176,7 @@ relation compile_model: (string, string list) => () =
string_append(fileprefix,".libs") => libsfilename &
Util.string_delimit_list(libs," ") => libs_str &
System.write_file(libsfilename,libs_str) &
Util.string_append_list([cit,omhome', pd, "Compiler",
pd, "scripts", pd, "Compile",cit," ",
Util.string_append_list([cit,omhome', pd, "bin", pd, "Compile",cit," ",
(*"\"",cd_path,"\""," ",*)
fileprefix (*, " "
,libs_str*)
Expand Down
65 changes: 52 additions & 13 deletions Compiler/Makefile.in
Expand Up @@ -8,7 +8,10 @@

srcdir= .
top_builddir= ..
builddir=$(top_builddir)/build/bin
builddir_bin=$(top_builddir)/build/bin
builddir_lib=$(top_builddir)/build/lib
builddir_inc=$(top_builddir)/build/include
builddir_doc=$(top_builddir)/build/doc

ANTLR_HOME = @antlrhome@
EXEEXT = @EXEEXT@
Expand Down Expand Up @@ -36,6 +39,9 @@ include Makefile.common
PROG = omc
PROGD = omcd

SCRIPT_FILES = Compile Compile.bat doPlot doPlot.bat
DOC_FILES = omc_helptext.txt omc_interactive_api.txt

#SUBDIRS= ast runtime
SUBDIRS = runtime absyn_builder modpar

Expand All @@ -46,32 +52,62 @@ SUBDIRS = runtime absyn_builder modpar
#all : debug
all : release

debug: $(PROGD)$(EXEEXT) $(SRCRDB)
debug: $(PROGD) dinstall

release: $(PROG)$(EXEEXT)
release: $(PROG) install

$(SRCRDB): %.rdb: omc_debug/%.rdb
cp $< $@

# @for x in $(SRCRDB); do \
# echo $$x;
# echo $$x;\
# cp omc_debug/$$x .; \
# done

$(PROG)$(EXEEXT): omc_release
cp omc_release/$(PROG)$(EXEEXT) $(builddir)/.
$(PROG): omc_release
cp omc_release/$(PROG)$(EXEEXT) $(builddir_bin)/

$(PROGD): omc_debug
cp omc_debug/$(PROGD)$(EXEEXT) $(builddir_bin)/

$(PROGD)$(EXEEXT): omc_debug
cp omc_debug/$(PROGD)$(EXEEXT) $(builddir)/.
install_doc:
for x in $(DOC_FILES); do \
echo Copying $$x into $(builddir_doc); \
cp doc/$$x $(builddir_doc)/; \
done

install_scripts:
for x in $(SCRIPT_FILES); do \
echo Copying $$x into $(builddir_bin); \
cp scripts/$$x $(builddir_bin)/; \
done


install: install_doc install_scripts
echo Copying $(PROG)$(EXEEXT) into $(builddir_bin)
cp omc_release/$(PROG)$(EXEEXT) $(builddir_bin)/
echo Copying needed helpfiles....
for x in $(DOC_FILES); do \
echo Copying $$x into $(builddir_bin) where omc expects it...; \
cp doc/$$x $(builddir_bin)/; \
done

dinstall: install_doc install_scripts $(SRCRDB)
cp *.rdb $(builddir_bin)/
echo Copying $(PROGD)$(EXEEXT) into $(builddir_bin)
cp omc_debug/$(PROGD)$(EXEEXT) $(builddir_bin)/
echo Copying needed helpfiles....
for x in $(DOC_FILES); do \
echo Copying $$x into $(builddir_bin) where omc expects it...; \
cp doc/$$x $(builddir_bin)/; \
done

omc_release:
(cd omc_release && $(MAKE))

omc_debug:
(cd omc_debug && $(MAKE))



#vctarget:
# @(cd omc_debug ; $(MAKE) vctarget)

Expand All @@ -80,7 +116,7 @@ vctarget:


test:
@(cd ../testsuite ; $(MAKE))
@(cd $(top_builddir)/testsuite ; $(MAKE))


#ast/libast.a:
Expand All @@ -97,7 +133,9 @@ clean:
done
(cd omc_release; $(MAKE) clean)
-$(RM) -f $(SRCH)
-$(RM) -f $(builddir)/$(PROG)$(EXEEXT)
-$(RM) -f $(builddir_bin)/$(PROG)$(EXEEXT)
-cd $(builddir_bin) && rm -f $(SCRIPT_FILES) && rm -f $(DOC_FILES)
-cd $(builddir_doc) && rm -f $(DOC_FILES)

dclean:
@for d in $(SUBDIRS); do \
Expand All @@ -107,7 +145,8 @@ dclean:
-$(RM) -f $(SRCRDB)
-$(RM) -f $(SRCH)
-$(RM) -f $(builddir)/$(PROGD)$(EXEEXT)

-cd $(builddir_bin) && rm -f $(SCRIPTS_FILES) && rm -f $(DOC_FILES)
-cd $(builddir_doc) && rm -f $(DOC_FILES)

reallyclean:
@for d in $(SUBDIRS); do \
Expand Down
8 changes: 5 additions & 3 deletions Compiler/SimCodegen.rml
Expand Up @@ -136,7 +136,9 @@ with "Settings.rml"
(** relation: generate_makefile
**
** This relation generates a makefile for the simulation code.
** It uses OPENMODELICAHOME as a reference to find c_runtime with libraries.
** It uses:
** - OPENMODELICAHOME/include as a reference to includes and
** - OPENMODELICAHOME/lib as a reference to library files
**)
relation generate_makefile: (string, (*filename*)
string, (* classname *)
Expand All @@ -151,8 +153,8 @@ relation generate_makefile: (string, (*filename*)
cname,": ",cpp_file, "\n",
"\t $(CXX) -o ",cname,".exe ", (* ".exe" is needed for a class that is in a package. *)
cpp_file,
" -L",omhome,"/c_runtime/",
" -I",omhome,"/c_runtime/ ",
" -L",omhome,"/lib/",
" -I",omhome,"/include/ ",
" -lsim -lg2c -lc_runtime ",libs', "\n"
]) => str &
System.write_file(filename,str)
Expand Down
12 changes: 10 additions & 2 deletions Compiler/absyn_builder/Makefile.in
@@ -1,3 +1,11 @@

top_builddir= ../..
builddir_bin=$(top_builddir)/build/bin
builddir_lib=$(top_builddir)/build/lib
builddir_inc=$(top_builddir)/build/include
builddir_doc=$(top_builddir)/build/doc


CC=gcc
CXX=g++

Expand All @@ -9,11 +17,11 @@ ANTLR_LIBP = -L@antlrlib@
RML_HOME = @rmlhome@
RML_INCP = -I@rmlinc@

FLAT_PARSE_HOME = ../../flat_modelica_parser
FLAT_PARSE_HOME = $(top_builddir)/flat_modelica_parser
FLAT_PARSE_INCP = -I$(FLAT_PARSE_HOME)/src
FLAT_PARSE_LIBP = -L$(FLAT_PARSE_HOME)/src

PARSE_HOME = ../../modelica_parser
PARSE_HOME = $(top_builddir)/modelica_parser
PARSE_INCP = -I$(PARSE_HOME)/src
PARSE_LIBP = -L$(PARSE_HOME)/src

Expand Down
8 changes: 7 additions & 1 deletion Compiler/modpar/Makefile.in
@@ -1,5 +1,10 @@
srcdir= .
top_builddir= ../..
builddir_bin=$(top_builddir)/build/bin
builddir_lib=$(top_builddir)/build/lib
builddir_inc=$(top_builddir)/build/include
builddir_doc=$(top_builddir)/build/doc


BOOST_HOME = @BOOSTHOME@
RMLINCLUDE = @rmlinc@
Expand All @@ -22,10 +27,11 @@ else
OBJECTS = TaskGraphExt_stub.o
endif
all: libmodpar.a

libmodpar.a: $(OBJECTS)
ar -r $@ $(OBJECTS)

INCFLAGS =-I$(RMLINCLUDE) -I$(BOOST_HOME) -I../../mosh/src
INCFLAGS =-I$(RMLINCLUDE) -I$(BOOST_HOME) -I$(top_builddir)/mosh/src

CFLAGS = $(INCFLAGS) -g -Wall -DUNIX=1
CXXFLAGS = $(CFLAGS)
Expand Down
9 changes: 7 additions & 2 deletions Compiler/omc_debug/Makefile.in
Expand Up @@ -25,6 +25,11 @@ EXEEXT = @EXEEXT@

srcdir = ..
top_builddir = ../..
builddir_bin=$(top_builddir)/build/bin
builddir_lib=$(top_builddir)/build/lib
builddir_inc=$(top_builddir)/build/include
builddir_doc=$(top_builddir)/build/doc


include $(srcdir)/Makefile.common

Expand All @@ -48,7 +53,7 @@ RML = @rmlc_bin@ -g -Wc,-O3 -Wr,-East,-Ecps,-Efol

SUBDIRS = $(srcdir)/runtime $(srcdir)/absyn_builder $(srcdir)/modpar

all : $(ALLRML) subdirs $(PROG)$(EXEEXT)
all : $(ALLRML) subdirs $(PROG)


.SUFFIXES:
Expand Down Expand Up @@ -83,7 +88,7 @@ vctarget: $(SRCC) absyn_subdir
absyn_subdir:
@(cd $(srcdir)/absyn_builder ; $(MAKE) vctarget)

$(PROG)$(EXEEXT): $(SRCO) $(AST) $(RTOBJ)
$(PROG): $(SRCO) $(AST) $(RTOBJ)
g++ -o $(PROG)$(EXEEXT) $(SRCO) $(AST) $(RTOBJ) $(LDFLAGS)

subdirs: $(SRCHSRCDIR)
Expand Down
7 changes: 6 additions & 1 deletion Compiler/omc_release/Makefile.in
Expand Up @@ -27,8 +27,13 @@ EXEEXT = @EXEEXT@

srcdir = ..
top_builddir = ../..
builddir_bin=$(top_builddir)/build/bin
builddir_lib=$(top_builddir)/build/lib
builddir_inc=$(top_builddir)/build/include
builddir_doc=$(top_builddir)/build/doc
include $(srcdir)/Makefile.common


ifeq ($(OSTYP),$(OS_MSYS))
LIBSOCKET=
CORBALIB=-L$(CORBAHOME)/lib -lmico -lwsock32
Expand Down Expand Up @@ -90,7 +95,7 @@ vctarget: $(SRCC) absyn_subdir
absyn_subdir:
@(cd $(srcdir)/absyn_builder ; $(MAKE) vctarget)

$(PROG)$(EXEEXT): $(SRCO) $(AST) $(RTOBJ)
$(PROG): $(SRCO) $(AST) $(RTOBJ)
g++ -o $(PROG)$(EXEEXT) $(SRCO) $(AST) $(RTOBJ) $(LDFLAGS)

subdirs: $(SRCHSRCDIR)
Expand Down
11 changes: 8 additions & 3 deletions Compiler/runtime/Makefile.in
Expand Up @@ -6,6 +6,13 @@
# $Id$
#

srcdir=../
top_builddir= ../..
builddir_bin=$(top_builddir)/build/bin
builddir_lib=$(top_builddir)/build/lib
builddir_inc=$(top_builddir)/build/include
builddir_doc=$(top_builddir)/build/doc

USE_CORBA = @USE_CORBA@
CORBAHOME = @CORBAHOME@

Expand All @@ -31,7 +38,7 @@ endif
SHELL = /bin/sh
CC = gcc
IDL = idl
CFLAGS += -I$(RMLINCLUDE) -I../../c_runtime -I../ -I. $(CORBAINCL)
CFLAGS += -I$(RMLINCLUDE) -I$(top_builddir)/c_runtime -I$(srcdir) -I. $(CORBAINCL)
CXXFLAGS = $(CFLAGS)
SRC = rtopts.c socketimpl.c printimpl.c systemimpl.c settingsimpl.c
CPPSRC = ptolemyio.cpp daeext.cpp ErrorMessage.cpp errorext.cpp $(CORBASRC)
Expand All @@ -46,5 +53,3 @@ omc_communication.h: omc_communication_impl.cpp corbaimpl.cpp

clean:
$(RM) -rf *.o


2 changes: 1 addition & 1 deletion Compiler/runtime/systemimpl.c
Expand Up @@ -206,7 +206,7 @@ void System_5finit(void)
{
set_cc("gcc");

set_cflags("-I$OPENMODELICAHOME/c_runtime -L$OPENMODELICAHOME/c_runtime -lc_runtime -lm $MODELICAUSERCFLAGS");
set_cflags("-I$OPENMODELICAHOME/include -L$OPENMODELICAHOME/lib -lc_runtime -lm $MODELICAUSERCFLAGS");


}
Expand Down
2 changes: 1 addition & 1 deletion Compiler/scripts/doPlot
@@ -1,2 +1,2 @@
#!/bin/sh
exec $OPENMODELICAHOME/ptplot "`cygpath -w $1`" &
exec java -cp "`cygpath -w ${OPENMODELICAHOME}/bin/ptplot.jar`" ptolemy.plot.plotml.EditablePlotMLApplication "`cygpath -w $1`" &
2 changes: 1 addition & 1 deletion Compiler/scripts/doPlot.bat
@@ -1,6 +1,6 @@
@echo off
if defined PTII goto runplot
set PTII=%OPENMODELICAHOME%\ptplot.jar
set PTII=%OPENMODELICAHOME%\bin\ptplot.jar
:runplot
start javaw -classpath %PTII% ptolemy.plot.plotml.EditablePlotMLApplication %1

12 changes: 9 additions & 3 deletions Compiler/test_codegen/Makefile.in
@@ -1,11 +1,17 @@
# -*- Mode: Makefile -*-

OMC=../omc
top_builddir=../..
builddir_bin=$(top_builddir)/build/bin
builddir_lib=$(top_builddir)/build/lib
builddir_inc=$(top_builddir)/build/include
builddir_doc=$(top_builddir)/build/doc

OMC=$(builddir_bin)/omc
CC=gcc

CFLAGS= -Wall -ansi -pedantic -I../../c_runtime
CFLAGS= -Wall -ansi -pedantic -I$(builddir_inc)

LDFLAGS= -L../../c_runtime
LDFLAGS= -L$(builddir_lib)

CDIR = csrc
ODIR = obj
Expand Down
2 changes: 1 addition & 1 deletion Compiler/winruntime/systemimpl.c
Expand Up @@ -165,7 +165,7 @@ void System_5finit(void)
char* omhome;
char* mingwpath;
set_cc("gcc");
set_cflags("-I%OPENMODELICAHOME%\\c_runtime -L%OPENMODELICAHOME%\\c_runtime -lc_runtime %MODELICAUSERCFLAGS%");
set_cflags("-I%OPENMODELICAHOME%\\include -L%OPENMODELICAHOME%\\lib -lc_runtime %MODELICAUSERCFLAGS%");
path = getenv("PATH");
omhome = getenv("OPENMODELICAHOME");
if (omhome) {
Expand Down

0 comments on commit 4340d89

Please sign in to comment.