SQLite

Check-in [c6e633ab73]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Improved comments on the transformation script and on the generated Makefile.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | msvcMakeMin
Files: files | file ages | folders
SHA1: c6e633ab73812fe38f3e969f1652f1b5759096e4
User & Date: drh 2016-01-23 19:47:00.459
Context
2016-01-23
20:09
Adjust the amalgamation-tarball build process so that it includes the MSVC makefile and the sqlite3.rc resource file. (check-in: e420f3dc93 user: drh tags: msvcMakeMin)
19:47
Improved comments on the transformation script and on the generated Makefile. (check-in: c6e633ab73 user: drh tags: msvcMakeMin)
19:24
Use the -integer option when sorting list elements. (check-in: 949aa614e1 user: mistachkin tags: msvcMakeMin)
Changes
Unified Diff Ignore Whitespace Patch
Changes to Makefile.min.msc.






1
2
3
4
5
6
7






#
# nmake Makefile for SQLite
#
###############################################################################
############################## START OF OPTIONS ###############################
###############################################################################

>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
#### DO NOT EDIT ####
# This makefile is automatically generated from the Makefile.msc at
# the root of the canonical SQLite source tree using the
# tool/mkmsvcmin.tcl script.
#

#
# nmake Makefile for SQLite
#
###############################################################################
############################## START OF OPTIONS ###############################
###############################################################################

Changes to tool/mkmsvcmin.tcl.
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
#!/usr/bin/tcl
#

# Removes and/or replaces specially marked sections from the Makefile

# for MSVC, writing the resulting output to another (different) file.
# In addition, some other strings are also removed and/or replaced if
# they are present in the Makefile.
#





set fromFileName [lindex $argv 0]

if {![file exists $fromFileName]} then {
  error "input file \"$fromFileName\" does not exist"
}

set toFileName [lindex $argv 1]

if {[file exists $toFileName]} then {
  error "output file \"$toFileName\" already exists"
}


proc readFile { fileName } {
  set file_id [open $fileName RDONLY]
  fconfigure $file_id -encoding binary -translation binary
  set result [read $file_id]
  close $file_id
  return $result
}

proc writeFile { fileName data } {
  set file_id [open $fileName {WRONLY CREAT TRUNC}]
  fconfigure $file_id -encoding binary -translation binary
  puts -nonewline $file_id $data
  close $file_id
  return ""
}

proc escapeSubSpec { data } {
  regsub -all -- {&} $data {\\\&} data
  regsub -all -- {\\(\d+)} $data {\\\\\1} data
  return $data
}

proc substVars { data } {
  return [uplevel 1 [list subst -nocommands -nobackslashes $data]]
}

#
# NOTE: This block is used to replace the section marked <<block1>> in
#       the Makefile, if it exists.
#
set blocks(1) [string trimleft [string map [list \\\\ \\] {
_HASHCHAR=^#
!IF ![echo !IFNDEF VERSION > rcver.vc] && \\


>
|
>
|
<
|
|
>
>
>
>
>
|
<
|
|
|
<
|
<
|
|
|
|
>







|







|





|



|







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
#!/usr/bin/tcl
#
# This script reads the regular MSVC makefile (../Makefile.msc) and outputs
# a revised version of that Makefile that is "minimal" in the sense that
# it uses the sqlite3.c amalgamation as input and does not require tclsh.
# The resulting "../Makefile.min.msc" is suitable for use in the amalgamation

# tarballs.
# 
if {$argc==0} {
  set basedir [file dir [file dir [file normalize $argv0]]]
  set fromFileName [file join $basedir Makefile.msc]
  set toFileName [file join $basedir Makefile.min.msc]
} else {
  set fromFileName [lindex $argv 0]

  if {![file exists $fromFileName]} then {
    error "input file \"$fromFileName\" does not exist"
  }

  set toFileName [lindex $argv 1]

  if {[file exists $toFileName]} then {
    error "output file \"$toFileName\" already exists"
  }
}

proc readFile { fileName } {
  set file_id [open $fileName RDONLY]
  fconfigure $file_id -encoding binary -translation binary
  set result [read $file_id]
  close $file_id
  return $result
}

proc writeFile { fileName data } {
  set file_id [open $fileName {WRONLY CREAT TRUNC}]
  fconfigure $file_id -encoding binary -translation binary
  puts -nonewline $file_id $data
  close $file_id
  return ""
}

proc escapeSubSpec { data } {
  regsub -all -- {&} $data {\\\&} data
  regsub -all -- {\\(\d+)} $data {\\\\\1} data
  return $data
}

proc substVars { data } {
  return [uplevel 1 [list subst -nocommands -nobackslashes $data]]
}

#
# NOTE: This block is used to replace the section marked <<block1>> in
#       the Makefile, if it exists.
#
set blocks(1) [string trimleft [string map [list \\\\ \\] {
_HASHCHAR=^#
!IF ![echo !IFNDEF VERSION > rcver.vc] && \\
63
64
65
66
67
68
69
70





71
72
73
74
75
76
77
78

$(LIBRESOBJS):	$(TOP)\sqlite3.rc rcver.vc $(SQLITE3H)
	echo #ifndef SQLITE_RESOURCE_VERSION > sqlite3rc.h
	echo #define SQLITE_RESOURCE_VERSION $(RESOURCE_VERSION) >> sqlite3rc.h
	echo #endif >> sqlite3rc.h
	$(LTRCOMPILE) -fo $(LIBRESOBJS) -DRC_VERONLY $(TOP)\sqlite3.rc
}]]






set data [readFile $fromFileName]

regsub -all -- {# <<mark>>\n.*?# <</mark>>\n} \
    $data "" data

foreach i [lsort -integer [array names blocks]] {
  regsub -all -- [substVars \
      {# <<block${i}>>\n.*?# <</block${i}>>\n}] \







|
>
>
>
>
>
|







67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87

$(LIBRESOBJS):	$(TOP)\sqlite3.rc rcver.vc $(SQLITE3H)
	echo #ifndef SQLITE_RESOURCE_VERSION > sqlite3rc.h
	echo #define SQLITE_RESOURCE_VERSION $(RESOURCE_VERSION) >> sqlite3rc.h
	echo #endif >> sqlite3rc.h
	$(LTRCOMPILE) -fo $(LIBRESOBJS) -DRC_VERONLY $(TOP)\sqlite3.rc
}]]

set data "#### DO NOT EDIT ####\n"
append data "# This makefile is automatically "
append data "generated from the [file tail $fromFileName] at\n"
append data "# the root of the canonical SQLite source tree using the\n"
append data "# tool/[file tail $argv0] script.\n#\n\n"
append data [readFile $fromFileName]

regsub -all -- {# <<mark>>\n.*?# <</mark>>\n} \
    $data "" data

foreach i [lsort -integer [array names blocks]] {
  regsub -all -- [substVars \
      {# <<block${i}>>\n.*?# <</block${i}>>\n}] \