Makefile
changeset 353 17bffb57a8c5
parent 352 4baeb6d13173
child 354 0f24db96b519
equal deleted inserted replaced
352:4baeb6d13173 353:17bffb57a8c5
     1 # matiec - a compiler for the programming languages defined in IEC 61131-3
       
     2 #
       
     3 # Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
       
     4 # Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
       
     5 #
       
     6 # This program is free software: you can redistribute it and/or modify
       
     7 # it under the terms of the GNU General Public License as published by
       
     8 # the Free Software Foundation, either version 3 of the License, or
       
     9 # (at your option) any later version.
       
    10 #
       
    11 # This program is distributed in the hope that it will be useful,
       
    12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    14 # GNU General Public License for more details.
       
    15 #
       
    16 # You should have received a copy of the GNU General Public License
       
    17 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
       
    18 
       
    19 # include the system specific Makefile
       
    20 include Makefile.$(shell uname)
       
    21 
       
    22 default: all
       
    23 
       
    24 all: iec2c iec2iec
       
    25 
       
    26 install: all
       
    27 	install -d $(INSTALL_PREDIR)/$(INSTALL_BINDIR)/ 
       
    28 	install -d $(INSTALL_PREDIR)/$(IECLIBDIR)/
       
    29 	install iec2c    $(INSTALL_PREDIR)/$(INSTALL_BINDIR)/
       
    30 	install lib/*.txt $(INSTALL_PREDIR)/$(IECLIBDIR)/
       
    31 #	install iec2iec   $(INSTALL_PREDIR)/$(INSTALL_BINDIR)/
       
    32 
       
    33 
       
    34 uninstall:
       
    35 	rm -f $(INSTALL_PREDIR)/$(INSTALL_BINDIR)/iec2c
       
    36 	rm -f $(INSTALL_PREDIR)/$(INSTALL_BINDIR)/iec2iec
       
    37 	for ff in `cd lib; ls *.txt; cd ..` do echo $$ff done
       
    38 #	for ff in `cd lib; ls *.txt; cd ..` do rm -f $(INSTALL_PREDIR)/$(IECLIBDIR)/$$ff done
       
    39 
       
    40 
       
    41 clean:
       
    42 	-rm -f iec2iec iec2c *.o absyntax/*.o
       
    43 	echo > Makefile.depend
       
    44 # make something everywhere (ie, in all Makefiles that have that target)
       
    45 	find . -depth -mindepth 2 -maxdepth 2 -name Makefile | sed 's/Makefile//g' | xargs -I {} $(MAKE) -C{} clean
       
    46 
       
    47 CXXFLAGS += -I.
       
    48 
       
    49 LIBS  = absyntax/absyntax.o absyntax/visitor.o
       
    50 LIBS += stage1_2/stage1_2.o stage1_2/iec.y.o stage1_2/iec.flex.o
       
    51 LIBS += stage3/stage3.o
       
    52 LIBS += stage3/visit_expression_type.o
       
    53 LIBS += absyntax_utils/absyntax_utils.o
       
    54 LIBS += absyntax_utils/search_expression_type.o
       
    55 LIBS += absyntax_utils/decompose_var_instance_name.o
       
    56 LIBS += absyntax_utils/function_call_iterator.o
       
    57 LIBS += absyntax_utils/function_call_param_iterator.o
       
    58 LIBS += absyntax_utils/function_param_iterator.o
       
    59 LIBS += absyntax_utils/search_base_type.o
       
    60 LIBS += absyntax_utils/search_constant_type.o
       
    61 LIBS += absyntax_utils/search_fb_instance_decl.o
       
    62 LIBS += absyntax_utils/search_fb_typedecl.o
       
    63 LIBS += absyntax_utils/search_varfb_instance_type.o
       
    64 LIBS += absyntax_utils/search_var_instance_decl.o
       
    65 LIBS += absyntax_utils/spec_init_separator.o
       
    66 LIBS += absyntax_utils/type_initial_value.o
       
    67 LIBS += absyntax_utils/add_en_eno_param_decl.o
       
    68 LIBS += absyntax_utils/get_sizeof_datatype.o
       
    69 LIBS += absyntax_utils/get_function_type.o
       
    70 
       
    71 
       
    72 
       
    73 iec2c: main.o stage4/generate_c/generate_c.o stage4/stage4.o $(LIBS)
       
    74 	$(CXX) -o iec2c main.o stage4/stage4.o stage4/generate_c/generate_c.o $(LIBS)
       
    75 
       
    76 
       
    77 iec2iec: main.o stage4/generate_iec/generate_iec.o stage4/stage4.o $(LIBS)
       
    78 	$(CXX) -o iec2iec main.o stage4/stage4.o stage4/generate_iec/generate_iec.o $(LIBS)
       
    79 
       
    80 
       
    81 #how to make things in subdirectories etc
       
    82 ../% /% absyntax/% stage1_2/% stage3/% stage4/% util/%:
       
    83 	$(MAKE) -C $(@D) $(@F)
       
    84 
       
    85 Makefile.depend depend:
       
    86 	$(CXX) -MM -MG -I. *.cc \
       
    87 	  | sed 's/:/ Makefile.depend:/' > Makefile.depend
       
    88 
       
    89 include Makefile.depend
       
    90 
       
    91 
       
    92