File: notes-tmake2qmake.txt

package info (click to toggle)
xxdiff 1%3A4.0.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 4,716 kB
  • ctags: 2,245
  • sloc: cpp: 18,495; python: 6,134; sh: 1,543; ansic: 1,535; perl: 308; lex: 284; yacc: 279; lisp: 250; tcl: 213; makefile: 82
file content (128 lines) | stat: -rw-r--r-- 3,207 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
===================
   Build Systems
===================
:Author: Martin Blais <blais@furius.ca>
:Date: 2006-05-14
:Abstract:

    Notes related to build systems, make, Jam, etc.

.. contents::
..
    1  Porting xxdiff to qmake
      1.1  TODO
      1.2  Done
      1.3  Links
      1.4  Lex/Yacc


Porting xxdiff to qmake
=======================
We're porting xxdiff to qmake 4.1.  Some notes of that process.


TODO
----

* Automatically generating the version.h file from the xxdiff/VERSION file::

    echo "#define XX_VERSION \"`cat ../VERSION`\"" > version.h

* Automatically generating the documentation input file with a sed
  command needs to be done automatically although this only needs
  be done once and ``doc.h`` could be saved if this is too
  difficult::

    sed -e 's/\"/\\\"/g;s/$/\\n\\/;1s/^/char text[]=\"/;$s/\\$/\"\;/' doc.html > doc.h


* Converting the source txt document to produce the html document can be done
  via another makefile, or if we can inject the following rule::

    .txt.html:
            rst2html.py --output-encoding=iso-8859-1 $< $@

  We could remove this dependencny and place it in a simple makefile, because
  only the author and people who would want modify the docs need to use it, and
  the output file is always provided in the distribution.  We certainly don't
  want to introduce a dependency on docutils.

* We need to remove resParser_lex.o and resParser_yacc.o from the build, we
  don't actually need to build them.  An alternative would be to remove them as
  includes to resParser.cpp and include their .h and use them the normal way.



Done
----

* We will need to change the source files somewhat, due to the following changes
  imposed by qmake::

    bison -d -o resParser.y.c resParser.y

  becomes::

    bison -d -o y.tab.c -p resParser -b resParser resParser.y

  Relatively easily done.  Renamed symbols in resParser.cpp.


* We may need to add an automatic dependency from cmdline.o to the yacc output
  files::

    cmdline.o: $(YACCOUTH)
    cmdline.obj: $(YACCOUTH)

  This was taken care of automatically by qmake.


* We need to add a dependency from resParser.o which includes the .y.h, .y.c and
  .l.c files::

    $(LEXOUT): $(LEXIN)
            $(LEX) $(LEXDEBUG) -o$(LEXOUT) $(LEXIN)

    $(YACCOUTC) $(YACCOUTH): $(YACCIN) $(LEXOUT)
            $(YACC) $(YACCDEBUG) -o$(YACCOUTC) $(YACCIN)

    $(PARSOBJ): $(YACCOUTC) $(YACCOUTH) $(LEXOUT)

  This was taken care of automatically by qmake.


* clean: Add a rule for removing the lex/yacc output files (.l.c, .y.h, .y.c)

  Easy: this is taken care of by the LEXSOURCES and YACCSOURCES.


* clean: Removing doc.h version.h

  Easy: we just added those to QMAKE_CLEAN.


* Customize the lex/yacc files for resParser::

    flex  -oresParser.l.c resParser.l
    bison -d  -oresParser.y.c resParser.y

  Easy: we use the following rules from `Undocumented Qmake`_

    QMAKE_LEX = flex

    QMAKE_YACC = bison

    solaris-cc {  
      QMAKE_YACCFLAGS_MANGLE = -o y.tab.c -p $base
    }

    linux-g++ {
      QMAKE_YACCFLAGS = -d -o y.tab.c
      QMAKE_YACC_HEADER =
      QMAKE_YACC_SOURCE =
    }



.. _`Undocumented Qmake`: http://paulf.free.fr/undocumented_qmake.html