Fossil

Hex Artifact Content
Login

Artifact f0e49e92670a94553f0e59764ee3787d85cf81d9:


0000: 23 21 2f 75 73 72 2f 62 69 6e 2f 6d 61 6b 65 0a  #!/usr/bin/make.
0010: 23 0a 23 20 54 68 69 73 20 69 73 20 74 68 65 20  #.# This is the 
0020: 74 6f 70 2d 6c 65 76 65 6c 20 6d 61 6b 65 66 69  top-level makefi
0030: 6c 65 20 66 6f 72 20 46 6f 73 73 69 6c 20 77 68  le for Fossil wh
0040: 65 6e 20 74 68 65 20 62 75 69 6c 64 20 69 73 20  en the build is 
0050: 6f 63 63 75 72 72 69 6e 67 0a 23 20 6f 6e 20 61  occurring.# on a
0060: 20 75 6e 69 78 20 70 6c 61 74 66 6f 72 6d 2e 20   unix platform. 
0070: 20 54 68 69 73 20 77 6f 72 6b 73 20 6f 75 74 2d   This works out-
0080: 6f 66 2d 74 68 65 2d 62 6f 78 20 6f 6e 20 6d 6f  of-the-box on mo
0090: 73 74 20 75 6e 69 78 20 70 6c 61 74 66 6f 72 6d  st unix platform
00a0: 73 2e 0a 23 20 42 75 74 20 79 6f 75 20 61 72 65  s..# But you are
00b0: 20 66 72 65 65 20 74 6f 20 76 61 72 79 20 73 6f   free to vary so
00c0: 6d 65 20 6f 66 20 74 68 65 20 64 65 66 69 6e 69  me of the defini
00d0: 74 69 6f 6e 73 20 69 66 20 64 65 73 69 72 65 64  tions if desired
00e0: 2e 0a 23 0a 23 23 23 23 20 54 68 65 20 74 6f 70  ..#.#### The top
00f0: 6c 65 76 65 6c 20 64 69 72 65 63 74 6f 72 79 20  level directory 
0100: 6f 66 20 74 68 65 20 73 6f 75 72 63 65 20 74 72  of the source tr
0110: 65 65 2e 20 20 46 6f 73 73 69 6c 20 63 61 6e 20  ee.  Fossil can 
0120: 62 65 20 62 75 69 6c 74 0a 23 20 20 20 20 69 6e  be built.#    in
0130: 20 61 20 64 69 72 65 63 74 6f 72 79 20 74 68 61   a directory tha
0140: 74 20 69 73 20 73 65 70 61 72 61 74 65 20 66 72  t is separate fr
0150: 6f 6d 20 74 68 65 20 73 6f 75 72 63 65 20 74 72  om the source tr
0160: 65 65 2e 20 20 4a 75 73 74 20 63 68 61 6e 67 65  ee.  Just change
0170: 0a 23 20 20 20 20 74 68 65 20 66 6f 6c 6c 6f 77  .#    the follow
0180: 69 6e 67 20 74 6f 20 70 6f 69 6e 74 20 66 72 6f  ing to point fro
0190: 6d 20 74 68 65 20 62 75 69 6c 64 20 64 69 72 65  m the build dire
01a0: 63 74 6f 72 79 20 74 6f 20 74 68 65 20 73 72 63  ctory to the src
01b0: 2f 20 66 6f 6c 64 65 72 2e 0a 23 0a 53 52 43 44  / folder..#.SRCD
01c0: 49 52 20 3d 20 2e 2f 73 72 63 0a 0a 23 23 23 23  IR = ./src..####
01d0: 20 54 68 65 20 64 69 72 65 63 74 6f 72 79 20 69   The directory i
01e0: 6e 74 6f 20 77 68 69 63 68 20 6f 62 6a 65 63 74  nto which object
01f0: 20 63 6f 64 65 20 66 69 6c 65 73 20 73 68 6f 75   code files shou
0200: 6c 64 20 62 65 20 77 72 69 74 74 65 6e 2e 0a 23  ld be written..#
0210: 0a 23 0a 4f 42 4a 44 49 52 20 3d 20 2e 2f 62 6c  .#.OBJDIR = ./bl
0220: 64 0a 0a 23 23 23 23 20 43 20 43 6f 6d 70 69 6c  d..#### C Compil
0230: 65 72 20 61 6e 64 20 6f 70 74 69 6f 6e 73 20 66  er and options f
0240: 6f 72 20 75 73 65 20 69 6e 20 62 75 69 6c 64 69  or use in buildi
0250: 6e 67 20 65 78 65 63 75 74 61 62 6c 65 73 20 74  ng executables t
0260: 68 61 74 0a 23 20 20 20 20 77 69 6c 6c 20 72 75  hat.#    will ru
0270: 6e 20 6f 6e 20 74 68 65 20 70 6c 61 74 66 6f 72  n on the platfor
0280: 6d 20 74 68 61 74 20 69 73 20 64 6f 69 6e 67 20  m that is doing 
0290: 74 68 65 20 62 75 69 6c 64 2e 20 20 54 68 69 73  the build.  This
02a0: 20 69 73 20 75 73 65 64 0a 23 20 20 20 20 74 6f   is used.#    to
02b0: 20 63 6f 6d 70 69 6c 65 20 63 6f 64 65 2d 67 65   compile code-ge
02c0: 6e 65 72 61 74 6f 72 20 70 72 6f 67 72 61 6d 73  nerator programs
02d0: 20 61 73 20 70 61 72 74 20 6f 66 20 74 68 65 20   as part of the 
02e0: 62 75 69 6c 64 20 70 72 6f 63 65 73 73 2e 0a 23  build process..#
02f0: 20 20 20 20 53 65 65 20 54 43 43 20 62 65 6c 6f      See TCC belo
0300: 77 20 66 6f 72 20 74 68 65 20 43 20 63 6f 6d 70  w for the C comp
0310: 69 6c 65 72 20 66 6f 72 20 62 75 69 6c 64 69 6e  iler for buildin
0320: 67 20 74 68 65 20 66 69 6e 69 73 68 65 64 20 62  g the finished b
0330: 69 6e 61 72 79 2e 0a 23 0a 42 43 43 20 3d 20 67  inary..#.BCC = g
0340: 63 63 0a 0a 23 23 23 23 20 54 68 65 20 73 75 66  cc..#### The suf
0350: 66 69 78 20 74 6f 20 61 64 64 20 74 6f 20 66 69  fix to add to fi
0360: 6e 61 6c 20 65 78 65 63 75 74 61 62 6c 65 20 66  nal executable f
0370: 69 6c 65 2e 20 20 57 68 65 6e 20 63 72 6f 73 73  ile.  When cross
0380: 2d 63 6f 6d 70 69 6c 69 6e 67 0a 23 20 20 20 20  -compiling.#    
0390: 74 6f 20 77 69 6e 64 6f 77 73 2c 20 6d 61 6b 65  to windows, make
03a0: 20 74 68 69 73 20 22 2e 65 78 65 22 2e 20 20 4f   this ".exe".  O
03b0: 74 68 65 72 77 69 73 65 20 6c 65 61 76 65 20 69  therwise leave i
03c0: 74 20 62 6c 61 6e 6b 2e 0a 23 0a 45 20 3d 0a 0a  t blank..#.E =..
03d0: 23 23 23 23 20 43 20 43 6f 6d 70 69 6c 65 20 61  #### C Compile a
03e0: 6e 64 20 6f 70 74 69 6f 6e 73 20 66 6f 72 20 75  nd options for u
03f0: 73 65 20 69 6e 20 62 75 69 6c 64 69 6e 67 20 65  se in building e
0400: 78 65 63 75 74 61 62 6c 65 73 20 74 68 61 74 0a  xecutables that.
0410: 23 20 20 20 20 77 69 6c 6c 20 72 75 6e 20 6f 6e  #    will run on
0420: 20 74 68 65 20 74 61 72 67 65 74 20 70 6c 61 74   the target plat
0430: 66 6f 72 6d 2e 20 20 54 68 69 73 20 69 73 20 75  form.  This is u
0440: 73 75 61 6c 6c 79 20 74 68 65 20 73 61 6d 65 0a  sually the same.
0450: 23 20 20 20 20 61 73 20 42 43 43 2c 20 75 6e 6c  #    as BCC, unl
0460: 65 73 73 20 79 6f 75 20 61 72 65 20 63 72 6f 73  ess you are cros
0470: 73 2d 63 6f 6d 70 69 6c 69 6e 67 2e 20 20 54 68  s-compiling.  Th
0480: 69 73 20 43 20 63 6f 6d 70 69 6c 65 72 20 62 75  is C compiler bu
0490: 69 6c 64 73 0a 23 20 20 20 20 74 68 65 20 66 69  ilds.#    the fi
04a0: 6e 69 73 68 65 64 20 62 69 6e 61 72 79 20 66 6f  nished binary fo
04b0: 72 20 66 6f 73 73 69 6c 2e 20 20 54 68 65 20 42  r fossil.  The B
04c0: 43 43 20 63 6f 6d 70 69 6c 65 72 20 61 62 6f 76  CC compiler abov
04d0: 65 20 69 73 20 75 73 65 64 0a 23 20 20 20 20 66  e is used.#    f
04e0: 6f 72 20 62 75 69 6c 64 69 6e 67 20 69 6e 74 65  or building inte
04f0: 72 6d 65 64 69 61 74 65 20 63 6f 64 65 2d 67 65  rmediate code-ge
0500: 6e 65 72 61 74 6f 72 20 74 6f 6f 6c 73 2e 0a 23  nerator tools..#
0510: 0a 23 54 43 43 20 3d 20 67 63 63 20 2d 4f 36 0a  .#TCC = gcc -O6.
0520: 23 54 43 43 20 3d 20 67 63 63 20 2d 67 20 2d 4f  #TCC = gcc -g -O
0530: 30 20 2d 57 61 6c 6c 20 2d 66 70 72 6f 66 69 6c  0 -Wall -fprofil
0540: 65 2d 61 72 63 73 20 2d 66 74 65 73 74 2d 63 6f  e-arcs -ftest-co
0550: 76 65 72 61 67 65 0a 54 43 43 20 3d 20 67 63 63  verage.TCC = gcc
0560: 20 2d 67 20 2d 4f 73 20 2d 57 61 6c 6c 0a 0a 23   -g -Os -Wall..#
0570: 20 54 6f 20 75 73 65 20 74 68 65 20 69 6e 63 6c   To use the incl
0580: 75 64 65 64 20 6d 69 6e 69 7a 20 6c 69 62 72 61  uded miniz libra
0590: 72 79 0a 23 20 46 4f 53 53 49 4c 5f 45 4e 41 42  ry.# FOSSIL_ENAB
05a0: 4c 45 5f 4d 49 4e 49 5a 20 3d 20 31 0a 23 20 54  LE_MINIZ = 1.# T
05b0: 43 43 20 2b 3d 20 2d 44 46 4f 53 53 49 4c 5f 45  CC += -DFOSSIL_E
05c0: 4e 41 42 4c 45 5f 4d 49 4e 49 5a 0a 0a 23 20 54  NABLE_MINIZ..# T
05d0: 6f 20 61 64 64 20 73 75 70 70 6f 72 74 20 66 6f  o add support fo
05e0: 72 20 48 54 54 50 53 0a 54 43 43 20 2b 3d 20 2d  r HTTPS.TCC += -
05f0: 44 46 4f 53 53 49 4c 5f 45 4e 41 42 4c 45 5f 53  DFOSSIL_ENABLE_S
0600: 53 4c 0a 0a 23 23 23 23 20 57 65 20 73 6f 6d 65  SL..#### We some
0610: 74 69 6d 65 73 20 61 64 64 20 74 68 65 20 2d 73  times add the -s
0620: 74 61 74 69 63 20 6f 70 74 69 6f 6e 20 68 65 72  tatic option her
0630: 65 20 73 6f 20 74 68 61 74 20 77 65 20 63 61 6e  e so that we can
0640: 20 62 75 69 6c 64 20 61 0a 23 20 20 20 20 73 74   build a.#    st
0650: 61 74 69 63 20 65 78 65 63 75 74 61 62 6c 65 20  atic executable 
0660: 74 68 61 74 20 77 69 6c 6c 20 72 75 6e 20 69 6e  that will run in
0670: 20 61 20 63 68 72 6f 6f 74 20 6a 61 69 6c 2e 0a   a chroot jail..
0680: 23 4c 49 42 20 3d 20 2d 73 74 61 74 69 63 0a 54  #LIB = -static.T
0690: 43 43 20 2b 3d 20 2d 44 46 4f 53 53 49 4c 5f 44  CC += -DFOSSIL_D
06a0: 59 4e 41 4d 49 43 5f 42 55 49 4c 44 3d 31 0a 0a  YNAMIC_BUILD=1..
06b0: 23 23 23 23 20 45 78 74 72 61 20 61 72 67 75 6d  #### Extra argum
06c0: 65 6e 74 73 20 66 6f 72 20 6c 69 6e 6b 69 6e 67  ents for linking
06d0: 20 74 68 65 20 66 69 6e 69 73 68 65 64 20 62 69   the finished bi
06e0: 6e 61 72 79 2e 20 20 46 6f 73 73 69 6c 20 6e 65  nary.  Fossil ne
06f0: 65 64 73 0a 23 20 20 20 20 74 6f 20 6c 69 6e 6b  eds.#    to link
0700: 20 61 67 61 69 6e 73 74 20 74 68 65 20 5a 2d 4c   against the Z-L
0710: 69 62 20 63 6f 6d 70 72 65 73 73 69 6f 6e 20 6c  ib compression l
0720: 69 62 72 61 72 79 20 75 6e 6c 65 73 73 20 74 68  ibrary unless th
0730: 65 20 6d 69 6e 69 7a 0a 23 20 20 20 20 6c 69 62  e miniz.#    lib
0740: 72 61 72 79 20 69 6e 20 74 68 65 20 73 6f 75 72  rary in the sour
0750: 63 65 20 74 72 65 65 20 69 73 20 62 65 69 6e 67  ce tree is being
0760: 20 75 73 65 64 2e 20 20 54 68 65 72 65 20 61 72   used.  There ar
0770: 65 20 6e 6f 20 6f 74 68 65 72 0a 23 20 20 20 20  e no other.#    
0780: 72 65 71 75 69 72 65 64 20 64 65 70 65 6e 64 65  required depende
0790: 6e 63 69 65 73 2e 0a 5a 4c 49 42 5f 4c 49 42 2e  ncies..ZLIB_LIB.
07a0: 30 20 3d 20 2d 6c 7a 0a 5a 4c 49 42 5f 4c 49 42  0 = -lz.ZLIB_LIB
07b0: 2e 31 20 3d 0a 5a 4c 49 42 5f 4c 49 42 2e 20 20  .1 =.ZLIB_LIB.  
07c0: 3d 20 24 28 5a 4c 49 42 5f 4c 49 42 2e 30 29 0a  = $(ZLIB_LIB.0).
07d0: 0a 23 20 49 66 20 75 73 69 6e 67 20 7a 6c 69 62  .# If using zlib
07e0: 3a 0a 4c 49 42 20 2b 3d 20 24 28 5a 4c 49 42 5f  :.LIB += $(ZLIB_
07f0: 4c 49 42 2e 24 28 46 4f 53 53 49 4c 5f 45 4e 41  LIB.$(FOSSIL_ENA
0800: 42 4c 45 5f 4d 49 4e 49 5a 29 29 20 24 28 4c 44  BLE_MINIZ)) $(LD
0810: 46 4c 41 47 53 29 0a 0a 23 20 49 66 20 75 73 69  FLAGS)..# If usi
0820: 6e 67 20 48 54 54 50 53 3a 0a 4c 49 42 20 2b 3d  ng HTTPS:.LIB +=
0830: 20 2d 6c 63 72 79 70 74 6f 20 2d 6c 73 73 6c 0a   -lcrypto -lssl.
0840: 0a 23 23 23 23 20 54 63 6c 20 73 68 65 6c 6c 20  .#### Tcl shell 
0850: 66 6f 72 20 75 73 65 20 69 6e 20 72 75 6e 6e 69  for use in runni
0860: 6e 67 20 74 68 65 20 66 6f 73 73 69 6c 20 74 65  ng the fossil te
0870: 73 74 73 75 69 74 65 2e 20 20 49 66 20 79 6f 75  stsuite.  If you
0880: 20 64 6f 20 6e 6f 74 0a 23 20 20 20 20 63 61 72   do not.#    car
0890: 65 20 61 62 6f 75 74 20 74 65 73 74 69 6e 67 20  e about testing 
08a0: 74 68 65 20 65 6e 64 20 72 65 73 75 6c 74 2c 20  the end result, 
08b0: 74 68 69 73 20 63 61 6e 20 62 65 20 62 6c 61 6e  this can be blan
08c0: 6b 2e 0a 23 0a 54 43 4c 53 48 20 3d 20 74 63 6c  k..#.TCLSH = tcl
08d0: 73 68 0a 0a 23 20 59 6f 75 20 73 68 6f 75 6c 64  sh..# You should
08e0: 20 6e 6f 74 20 6e 65 65 64 20 74 6f 20 63 68 61   not need to cha
08f0: 6e 67 65 20 61 6e 79 74 68 69 6e 67 20 62 65 6c  nge anything bel
0900: 6f 77 20 74 68 69 73 20 6c 69 6e 65 0a 23 23 23  ow this line.###
0910: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23  ################
0920: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23  ################
0930: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23  ################
0940: 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23 23  ################
0950: 23 23 23 23 23 23 23 23 23 23 23 23 0a 23 0a 23  ############.#.#
0960: 20 41 75 74 6f 6d 61 74 69 63 20 70 6c 61 74 66   Automatic platf
0970: 6f 72 6d 2d 73 70 65 63 69 66 69 63 20 6f 70 74  orm-specific opt
0980: 69 6f 6e 73 2e 0a 48 4f 53 54 5f 4f 53 5f 43 4d  ions..HOST_OS_CM
0990: 44 20 3d 20 75 6e 61 6d 65 20 2d 73 0a 48 4f 53  D = uname -s.HOS
09a0: 54 5f 4f 53 20 3d 20 24 28 48 4f 53 54 5f 4f 53  T_OS = $(HOST_OS
09b0: 5f 43 4d 44 3a 73 68 29 0a 0a 4c 49 42 2e 53 75  _CMD:sh)..LIB.Su
09c0: 6e 4f 53 3d 20 2d 6c 73 6f 63 6b 65 74 20 2d 6c  nOS= -lsocket -l
09d0: 6e 73 6c 0a 4c 49 42 20 2b 3d 20 24 28 4c 49 42  nsl.LIB += $(LIB
09e0: 2e 24 28 48 4f 53 54 5f 4f 53 29 29 0a 0a 54 43  .$(HOST_OS))..TC
09f0: 43 2e 44 72 61 67 6f 6e 46 6c 79 20 2b 3d 20 2d  C.DragonFly += -
0a00: 44 55 53 45 5f 50 52 45 41 44 0a 54 43 43 2e 46  DUSE_PREAD.TCC.F
0a10: 72 65 65 42 53 44 20 2b 3d 20 2d 44 55 53 45 5f  reeBSD += -DUSE_
0a20: 50 52 45 41 44 0a 54 43 43 2e 4e 65 74 42 53 44  PREAD.TCC.NetBSD
0a30: 20 2b 3d 20 2d 44 55 53 45 5f 50 52 45 41 44 0a   += -DUSE_PREAD.
0a40: 54 43 43 2e 4f 70 65 6e 42 53 44 20 2b 3d 20 2d  TCC.OpenBSD += -
0a50: 44 55 53 45 5f 50 52 45 41 44 0a 54 43 43 20 2b  DUSE_PREAD.TCC +
0a60: 3d 20 24 28 54 43 43 2e 24 28 48 4f 53 54 5f 4f  = $(TCC.$(HOST_O
0a70: 53 29 29 0a 0a 69 6e 63 6c 75 64 65 20 24 28 53  S))..include $(S
0a80: 52 43 44 49 52 29 2f 6d 61 69 6e 2e 6d 6b 0a     RCDIR)/main.mk.