Skip to content

Commit

Permalink
- Added c_runtime/Makefile.common.
Browse files Browse the repository at this point in the history
- You now only need to change one file when you add headers.


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@5135 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Mar 12, 2010
1 parent af09153 commit 67fe549
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 78 deletions.
87 changes: 9 additions & 78 deletions c_runtime/Makefile
@@ -1,47 +1,17 @@
# Adrian Pop, adrpo@ida.liu.se, Martin Sjölund, marsj@ida.liu.se
# - Use make -f Makefile.omdev.mingw if you want to compile on Windows/MinGW
# - Please leave the UNIX Makefile as it is if you are not using UNIX/Linux
# If you need to add files, etc, you modify Makefile.common - a common file
# for both UNIX/Linux and Windows platforms.

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

OBJS_JAVA=java_interface.o
HEADER_EXTJAVA=$(OBJS_JAVA:.o=.h)
INCLUDE_JAVA=-I/usr/lib/jvm/default-java/include

CC = gcc
FC = g77
AR = ar -ru
UNAME := $(shell uname -m)
CMDFPUFLAGS := `case ${UNAME} in i[3456]86) echo "-msse2 -mfpmath=sse";; x86_64) echo "-msse2 -mfpmath=sse -fPIC";; *) echo "";; esac`
FPUFLAGS := ${CMDFPUFLAGS}
CFLAGS = -Wall -O3 ${FPUFLAGS} -fexceptions -ansi -pedantic -I. $(EXTRA_CFLAGS) $(INCLUDE_JAVA)
CPPFLAGS = $(CFLAGS)
FFLAGS = -O -fexceptions
# P.A: before, g77 had -O3 or -O2 but that caused a bug in DDASRT, giving infinite loop.
# Adrian Pop, adrpo@ida.liu.se
# - please leave makefile.u as if you don't it breaks the compilation on UNIX/LINUX
# - use make -f Makefile.omdev.mingw if you want to compile on MinGW

OBJS = $(FOBJS) boolean_array.o index_spec.o integer_array.o memory_pool.o \
base_array.o real_array.o string_array.o read_write.o utility.o \
modelica_string.o bigden.o \
ddasrt.o dlinpk.o enorm.o hybrd1.o nelmead.o qform.o r1updt.o \
biglag.o ddassl.o dogleg.o fdjac1.o hybrj.o newuoa.o qrfac.o trsapp.o \
daux.o dlamch.o dpmpar.o hybrd.o lsame.o newuob.o r1mpyq.o update.o \
java_interface.o meta_modelica.o meta_modelica_builtin.o $(EXTRA_OBJS)

SIMOBJS = $(FOBJS) simulation_runtime.o simulation_init.o simulation_input.o simulation_events.o \
solver_dasrt.o solver_euler.o simulation_result.o simulation_delay.o tables.o options.o dgesv_aux.o $(EXTRA_SIMOBJS)

HFILES = blaswrap.h f2c.h integer_array.h memory_pool.h modelica_string.h \
base_array.h inline.h real_array.h string_array.h boolean_array.h \
index_spec.h matrix.h \
modelica.h read_write.h simulation_runtime.h simulation_events.h utility.h \
simulation_init.h simulation_input.h solver_dasrt.h solver_euler.h simulation_result.h \
meta_modelica.h meta_modelica_builtin.h sendData/sendData.h sendData/humbug.h \
java_interface.h jni.h jni_md.h jni_md_solaris.h jni_md_windows.h \
simulation_delay.h fortran_types.h

LIBS = libc_runtime.a libsim.a

ifdef QTHOME
PLTPKGCMD = cd ./sendData && $(QTHOME)/bin/qmake && $(MAKE) -f Makefile
Expand All @@ -51,46 +21,7 @@ g++ -c -o sendData/libsendData.o sendData/humbug.cpp && \
ar -ru sendData/release/libsendData.a sendData/libsendData.o
endif

all : $(SIMOBJS) $(OBJS) libc_runtime.a libsim.a libf2c/libf2c.a libsendData.a install

# recompile all if a header changes!
$(SIMOBJS) : $(HFILES) *.c*
$(OBJS) : $(HFILES) *.c*

libc_runtime.a : $(OBJS) $(HFILES)
$(AR) $@ $(OBJS)


install: libc_runtime.a libsim.a libf2c/libf2c.a
cp $(HFILES) $(builddir_inc)/
cp $(LIBS) $(builddir_lib)/
cp libf2c/libf2c.* $(builddir_lib)/
cp sendData/release/libsendData.a $(builddir_lib)/
@$(MAKE) -C java_interface -f Makefile || $(MAKE) -C java_interface -f Makefile.omdev.mingw install

libsim.a : $(SIMOBJS) $(HFILES)
$(AR) $@ $(SIMOBJS)

libf2c/libf2c.a :
$(MAKE) -C libf2c -f makefile.u

libsendData.a : sendData/sendData.cpp sendData/sendData.h sendData/sendData.pro sendData/humbug.h sendData/humbug.cpp
# cd ./sendData && \
# $(QTHOME)/bin/qmake && \
# sed -e's/QtNetwork /QtNetwork4 /' -e's/QtGui /QtGui4 /' -e's/QtCore /QtCore4 /' Makefile.Release > Makefile && \
# $(MAKE) -f Makefile
$(PLTPKGCMD)
LIBF2CMAKEFILE = makefile.u
JAVAMAKEFILE = Makefile
include Makefile.common

clean :
$(MAKE) -C libf2c -f makefile.u clean
rm -f libc_runtime.a
rm -f libsim.a
rm -f $(OBJS)
rm -f $(SIMOBJS)
rm -f $(builddir_lib)/libc_runtime.a
rm -f $(builddir_lib)/libsim.a
rm -f $(builddir_lib)/libf2c.*
cd $(builddir_inc)/ && rm -f $(HFILES)
cd sendData && rm -fr release debug *sendData*.o *sendData*.a
rm -rf sendData/release sendData/debug
rm -f sendData.o sendData.a sendData/releasesendData.o
71 changes: 71 additions & 0 deletions c_runtime/Makefile.common
@@ -0,0 +1,71 @@
CC = gcc
FC = g77
AR = ar -ru
CFLAGS = -Wall -O3 $(FPUFLAGS) -ansi -pedantic -I. $(EXTRA_CFLAGS)
CPPFLAGS = $(CFLAGS)
FFLAGS = -O -fexceptions
# P.A: before, g77 had -O3 or -O2 but that caused a bug in DDASRT, giving infinite loop.

OBJS = $(FOBJS) boolean_array.o index_spec.o integer_array.o memory_pool.o \
base_array.o real_array.o string_array.o read_write.o utility.o \
modelica_string.o bigden.o \
ddasrt.o dlinpk.o enorm.o hybrd1.o nelmead.o qform.o r1updt.o \
biglag.o ddassl.o dogleg.o fdjac1.o hybrj.o newuoa.o qrfac.o trsapp.o \
daux.o dlamch.o dpmpar.o hybrd.o lsame.o newuob.o r1mpyq.o update.o \
java_interface.o meta_modelica.o meta_modelica_builtin.o $(EXTRA_OBJS)

SIMOBJS = $(FOBJS) simulation_runtime.o simulation_init.o simulation_input.o simulation_events.o \
solver_dasrt.o solver_euler.o simulation_result.o simulation_delay.o tables.o options.o dgesv_aux.o $(EXTRA_SIMOBJS)

HFILES = blaswrap.h f2c.h integer_array.h memory_pool.h modelica_string.h \
base_array.h inline.h real_array.h string_array.h boolean_array.h \
index_spec.h matrix.h \
modelica.h read_write.h simulation_runtime.h simulation_events.h utility.h \
simulation_init.h simulation_input.h solver_dasrt.h solver_euler.h simulation_result.h \
meta_modelica.h meta_modelica_builtin.h sendData/sendData.h sendData/humbug.h \
java_interface.h jni.h jni_md.h jni_md_solaris.h jni_md_windows.h \
simulation_delay.h fortran_types.h

LIBS = libc_runtime.a libsim.a

all : libc_runtime.a libsim.a libf2c/libf2c.a libsendData.a install

#recompile all if a header changes!
$(SIMOBJS) : $(HFILES)
$(OBJS) : $(HFILES)

libc_runtime.a : $(OBJS) $(HFILES)
$(AR) $@ $(OBJS)

libsim.a : $(SIMOBJS) $(HFILES)
$(AR) $@ $(SIMOBJS)

libf2c/libf2c.a :
cd libf2c && $(MAKE) -f $(LIBF2CMAKEFILE)

libsendData.a : sendData/sendData.cpp sendData/sendData.h sendData/sendData.pro
$(PLTPKGCMD)

install: libc_runtime.a libsim.a libf2c/libf2c.a
cp $(HFILES) $(builddir_inc)/
cp $(LIBS) $(builddir_lib)/
cp libf2c/libf2c.* $(builddir_lib)/
cp sendData/release/libsendData.a $(builddir_lib)/
@make -C java_interface -f $(JAVAMAKEFILE) || make -C java_interface -f $(JAVAMAKEFILE) install

clean :
$(MAKE) -C libf2c -f $(LIBF2CMAKEFILE) clean
$(MAKE) -C java_interface -f $(JAVAMAKEFILE) clean
rm -f libc_runtime.a
rm -f libsim.a
rm -f $(OBJS)
rm -f $(SIMOBJS)
rm -f $(builddir_lib)/libc_runtime.a
rm -f $(builddir_lib)/libsim.a
rm -f $(builddir_lib)/libf2c.*
rm -f $(builddir_lib)/libsendData.a
cd $(builddir_inc)/ && rm -f $(HFILES)
cd sendData && rm -fr release debug *sendData*.o *sendData*.a
rm -rf sendData/release sendData/debug
rm -f sendData.o sendData.a sendData/releasesendData.o

3 changes: 3 additions & 0 deletions c_runtime/java_interface/Makefile.common
Expand Up @@ -106,6 +106,9 @@ ifeq ($(TARGET),install)
@echo "* To compile, set JAVA_HOME to a JDK or add javac to the PATH."
endif

clean:
rm -rf bin-jar modelica_java.jar

%Lexer.java: %.g
$(antlr_compile) $<
%Parser.java: %.g
Expand Down

0 comments on commit 67fe549

Please sign in to comment.