Artifact b80c78c06063fca34d1815f5bfa95a1044eef027
File
src/makemake.tcl
part of check-in
[1b52d1306e]
- Fix the makefile so that you can build twice in a row from the source
directory and it still works.
by
drh on
2008-02-01 19:58:07.
Also file
src/makemake.tcl
part of check-in
[dbdc160161]
- Merged with mainline.
by
aku on
2008-02-02 07:33:03.
#!/usr/bin/tclsh
#
# Run this TCL script to generate the "main.mk" makefile.
#
# Basenames of all source files:
#
set src {
add
bag
blob
branch
cgi
checkin
checkout
clearsign
clone
comformat
construct
content
db
delta
deltacmd
descendents
diff
diffcmd
encode
file
http
info
login
main
manifest
md5
merge
merge3
name
pivot
pqueue
printf
rebuild
rss
schema
setup
sha1
style
subscript
sync
tag
timeline
tkt
tktconfig
tktsetup
undo
update
url
user
verify
vfile
wiki
wikiformat
xfer
zip
}
# Name of the final application
#
set name fossil
puts {# DO NOT EDIT
#
# This file is automatically generated. Instead of editing this
# file, edit "makemake.tcl" then run "tclsh makemake.tcl >main.mk"
# to regenerate this file.
#
# This file is included by linux-gcc.mk or linux-mingw.mk or possible
# some other makefiles. This file contains the rules that are common
# to building regardless of the target.
#
XTCC = $(TCC) $(CFLAGS) -I. -I$(SRCDIR)
}
puts -nonewline "SRC ="
foreach s [lsort $src] {
puts -nonewline " \\\n \$(SRCDIR)/$s.c"
}
puts "\n"
puts -nonewline "TRANS_SRC ="
foreach s [lsort $src] {
puts -nonewline " \\\n ${s}_.c"
}
puts "\n"
puts -nonewline "OBJ ="
foreach s [lsort $src] {
puts -nonewline " \\\n $s.o"
}
puts "\n"
puts "APPNAME = $name\$(E)"
puts "\n"
puts {
all: $(APPNAME)
install: $(APPNAME)
mv $(APPNAME) $(INSTALLDIR)
translate: $(SRCDIR)/translate.c
$(BCC) -o translate $(SRCDIR)/translate.c
makeheaders: $(SRCDIR)/makeheaders.c
$(BCC) -o makeheaders $(SRCDIR)/makeheaders.c
mkindex: $(SRCDIR)/mkindex.c
$(BCC) -o mkindex $(SRCDIR)/mkindex.c
# WARNING. DANGER. Running the testsuite modifies the repository the
# build is done from, i.e. the checkout belongs to. Do not sync/push
# the repository after running the tests.
test: $(APPNAME)
$(TCLSH) test/tester.tcl $(APPNAME)
VERSION.h: $(SRCDIR)/../manifest.uuid $(SRCDIR)/../manifest
awk '{ printf "#define MANIFEST_UUID \"%s\"\n", $$1}' \
$(SRCDIR)/../manifest.uuid >VERSION.h
awk '{ printf "#define MANIFEST_VERSION \"[%.10s]\"\n", $$1}' \
$(SRCDIR)/../manifest.uuid >>VERSION.h
awk '$$1=="D"{printf "#define MANIFEST_DATE \"%s %s\"\n",\
substr($$2,1,10),substr($$2,12)}' \
$(SRCDIR)/../manifest >>VERSION.h
$(APPNAME): headers $(OBJ) sqlite3.o
$(TCC) -o $(APPNAME) $(OBJ) sqlite3.o $(LIB)
# This rule prevents make from using its default rules to try build
# an executable named "manifest" out of the file named "manifest.c"
#
$(SRCDIR)/../manifest:
# noop
clean:
rm -f *.o *_.c $(APPNAME) VERSION.h
rm -f translate makeheaders mkindex page_index.h headers}
set hfiles {}
foreach s [lsort $src] {lappend hfiles $s.h}
puts "\trm -f $hfiles\n"
set mhargs {}
foreach s [lsort $src] {
append mhargs " ${s}_.c:$s.h"
set extra_h($s) {}
}
append mhargs " \$(SRCDIR)/sqlite3.h ./VERSION.h"
puts "headers:\tmakeheaders mkindex \$(TRANS_SRC) ./VERSION.h"
puts "\t./makeheaders $mhargs"
puts "\t./mkindex \$(TRANS_SRC) >page_index.h"
puts "\ttouch headers\n"
set extra_h(main) page_index.h
foreach s [lsort $src] {
puts "${s}_.c:\t\$(SRCDIR)/$s.c \$(SRCDIR)/VERSION translate"
puts "\t./translate \$(SRCDIR)/$s.c | sed -f \$(SRCDIR)/VERSION >${s}_.c\n"
puts "$s.o:\t${s}_.c $s.h $extra_h($s) \$(SRCDIR)/config.h"
puts "\t\$(XTCC) -o $s.o -c ${s}_.c\n"
puts "$s.h:\tmakeheaders"
puts "\t./makeheaders $mhargs\n\ttouch headers\n"
}
puts "sqlite3.o:\t\$(SRCDIR)/sqlite3.c"
set opt {-DSQLITE_OMIT_LOAD_EXTENSION=1 -DSQLITE_PRIVATE=}
append opt " -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4"
append opt " -DSQLITE_ENABLE_FTS3=1"
puts "\t\$(XTCC) $opt -c \$(SRCDIR)/sqlite3.c -o sqlite3.o\n"