Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@735 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
- Loading branch information
henjo
committed
Feb 14, 2002
1 parent
563b2d7
commit 3acd52a
Showing
10 changed files
with
672 additions
and
276 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# -*- Mode: Makefile -*- | ||
# | ||
# TARGET is specified on the command line | ||
# eg. | ||
# >make -f Makefile.single TARGET=algorithm_for1 | ||
# | ||
|
||
MODEQ=$(MOSHHOME)/../modeq/modeq | ||
CC=gcc | ||
|
||
CRTHOME=$(MOSHHOME)/../c_runtime | ||
|
||
CFLAGS= -W -Wall -ansi -pedantic-errors -Werror -g -I$(CRTHOME) -I. | ||
|
||
LDFLAGS= -L$(CRTHOME) -lm | ||
|
||
CDIR = csrc | ||
ODIR = obj | ||
BDIR = . | ||
|
||
MOFILES = $(TARGET:=.mo) | ||
TARGETS = $(MOFILES:%.mo=$(BDIR)/%) | ||
OBJS = $(MOFILES:%.mo=$(ODIR)/%.main.o) | ||
GENC = $(MOFILES:%.mo=$(CDIR)/%.c) | ||
|
||
|
||
all : $(CDIR) $(ODIR) $(BDIR) $(TARGETS) | ||
|
||
|
||
$(TARGETS) : $(BDIR)/% : $(ODIR)/%.main.o | ||
rm -f $@ | ||
gcc -g -o $@ $(LDFLAGS) $< -lc_runtime | ||
|
||
$(OBJS) : $(ODIR)/%.main.o : $(CDIR)/%.c $(MOSHHOME)/build/main.c | ||
rm -f $(TARGETS) | ||
@echo compiling $(subst .main.o,,$@) | ||
$(CC) $(CFLAGS) \ | ||
-DCFILE_TO_INCLUDE="\"$(subst $(ODIR),$(CDIR),$(subst .main.o,.c,$@))\""\ | ||
-DCFUNCTION_TO_CALL="$(subst $(ODIR)/,,$(subst .main.o,,$@))_read_call_write"\ | ||
-c -o $@ $(MOSHHOME)/build/main.c | ||
|
||
$(GENC) : $(CDIR)/%.c : %.mo | ||
@$(MODEQ) $< +d=codegen > $@ | ||
|
||
$(CDIR) $(ODIR) $(BDIR) : % : | ||
mkdir $@ | ||
|
||
.SUFFIXES: .mo | ||
|
||
|
||
.mo.c: | ||
if not @$(MODEQ) $< +d=codegen > $(<:.mo=.c); then cat $(<:.mo=.c); fi | ||
|
||
clean : | ||
rm -f $(TARGETS) | ||
rm -f $(OBJS) | ||
rm -f $(GENC) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <errno.h> | ||
|
||
#include CFILE_TO_INCLUDE | ||
|
||
|
||
|
||
int main(int argc, char** argv) | ||
{ | ||
|
||
if (argc != 3) | ||
{ | ||
fprintf(stderr,"# Incorrrect number of arguments\n"); | ||
return 1; | ||
} | ||
|
||
|
||
CFUNCTION_TO_CALL(argv[1],argv[2]); | ||
|
||
return 0; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.