1 # Makefile to generate a DOL program
3 # Type 'make help' to get a list of targets.
8 # code generator to use
9 # use '-C' (SystemC) or '-H' (HdS)
12 # change according to your system
13 DOLPATH = $(HOME)/jump/dol/jars
14 SYSTEMC_INC = $(HOME)/systemc/include
15 SYSTEMC_LIB = $(HOME)/systemc/lib-linux64/libsystemc.a
26 # don't change anything below
27 # ===========================================================================
30 CLASSPATH = $(DOLPATH)/dol.jar:$(DOLPATH)/jdom.jar:$(DOLPATH)/xercesImpl.jar
31 .PHONY : help all run codegen dotty clean
34 @$(ECHO) "Target List:\n" \
35 "\thelp -- show this help [default]\n" \
36 "\tall -- generate '$(PROGRAM)'\n" \
37 "\trun -- generate and run '$(PROGRAM)'\n" \
38 "\tcodegen -- generate code, but do not compile\n" \
39 "\tdotty -- show flattened process network using DOTTY\n" \
40 "\tclean -- clean generated files\n"
44 codegen: $(SRCPATH)/src/Makefile.new
47 @$(ECHO) "\t[RUN]\t$^"
52 @$(RM) -rf $(PROGRAM) $(SRCPATH)/ $(PROGRAM)_flattened.xml \
53 $(PROGRAM)_Generator.java $(PROGRAM)_Generator.class \
54 $(PROGRAM).dot profile.txt output.txt
56 $(PROGRAM): $(SRCPATH)/src/sc_application
57 @$(ECHO) "\t[COPY]\t$@"
60 $(SRCPATH)/src/sc_application: $(SRCPATH)/src/Makefile.new
61 @$(ECHO) "\t[MAKE]\t$<"
62 @$(MAKE) -f Makefile.new -C $(SRCPATH)/src
64 $(SRCPATH)/src/Makefile.new: $(SRCPATH)/src/Makefile
65 @$(ECHO) "\t[GEN]\t$@"
66 @$(SED) -e 's@^SYSTEMC_INC.*@SYSTEMC_INC = -I$(SYSTEMC_INC)@' \
67 -e 's@^SYSTEMC_LIB.*@SYSTEMC_LIB = $(SYSTEMC_LIB)@' \
68 -e 's@^MY_LIB_INC.*@& -lpthread@' \
69 $(SRCPATH)/src/Makefile > $(SRCPATH)/src/Makefile.new
71 $(SRCPATH)/src/Makefile: $(PROGRAM)_flattened.xml
72 @$(ECHO) "\t[GEN]\t$@"
73 @$(JAVA) -cp $(CLASSPATH) dol.main.Main -P $(PROGRAM)_flattened.xml \
74 $(CODEGEN) $(SRCPATH) -c >/dev/null
76 $(PROGRAM)_flattened.xml: $(PROGRAM).xml
77 @$(ECHO) "\t[FLAT]\t$^"
78 @$(JAVA) -cp $(CLASSPATH) dol.helper.flattener.XMLFlattener \
79 $(PROGRAM).xml $(PROGRAM)_Generator >/dev/null
80 @$(JAVAC) $(PROGRAM)_Generator.java
81 @$(JAVA) $(PROGRAM)_Generator > $(PROGRAM)_flattened.xml
83 $(PROGRAM).dot: $(PROGRAM)_flattened.xml
84 @$(ECHO) "\t[GEN]\t$@"
85 @$(JAVA) -cp $(CLASSPATH) dol.main.Main -P $(PROGRAM)_flattened.xml \
86 -D $(PROGRAM).dot -c >/dev/null
89 @$(ECHO) "\t[RUN]\t$(DOTTY) $(PROGRAM).dot"
90 @$(DOTTY) $(PROGRAM).dot