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 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243
|
########################################################################
# Configuration.
#
open build/C
open build/svn_realclean
include mk/defaults
include mk/make_gen
.PHONY: realclean clean install all main
#
# Architecture-specific configuration
#
if $(equal $(OSTYPE), Win32)
#
# Extra options for the C compiler
#
CFLAGS += /MT /DWIN32 /W4 /WX
#
# Don't build man pages
#
MAN_ENABLED = false
#
# Always use threads
#
THREADS_ENABLED = true
export
else
#
# Extra options for the C compiler
#
CFLAGS += -g -O2 -Wall -Werror -Wno-unused
#
# We never need threads on Unix
#
THREADS_ENABLED = false
export
#
# General options
#
SCANNER_MODE = error
#
# Location of the OCaml library
#
if $(not $(defined CAMLLIB))
CAMLLIB = $(dir $(string $(getenv CAMLLIB, $(getenv OCAMLLIB, $(CAMLLIB_DEFAULT)))))
export
#
# OCaml options
#
OCAMLFLAGS[] += -w a
if $(THREADS_ENABLED)
OCAMLFLAGS += -thread
export
#
# Support for profiling
#
if $(not $(defined NATIVE_PROFILE))
NATIVE_PROFILE = false
export
if $(NATIVE_PROFILE)
OCAMLOPTFLAGS += -p -inline 0
if $(equal $(NATIVE_PROFILE), compact)
OCAMLOPTFLAGS += -compact
export
export
#
# Libraries (without suffixes)
#
OCAML_OTHER_LIBS = unix
if $(THREADS_ENABLED)
OCAML_OTHER_LIBS += threads
export
#
# C options
#
INCLUDES += $(CAMLLIB) .
EXTRA_CLIBS[] =
if $(READLINE_ENABLED)
CFLAGS += $(READLINE_CFLAGS)
EXTRA_CLIBS += $(READLINE_CLIBS)
export
if $(NCURSES_ENABLED)
CFLAGS += $(NCURSES_CFLAGS)
EXTRA_CLIBS += $(NCURSES_CLIBS)
export
if $(FAM_ENABLED)
CFLAGS += $(FAM_CFLAGS)
EXTRA_CLIBS += $(FAM_CLIBS)
export
OCAML_LINK_FLAGS = $(mapprefix -cclib, $(set $(EXTRA_CLIBS)))
#
# Name of the genmagic program
#
VERSION_TXT = $(file version.txt)
GENMAGIC = $(file src/magic/omake_gen_magic)
########################################################################
# Clean up
#
CLEAN = rm -rf *.cm* *~ .\#* *.o *.obj *.a *.lib *.exe *.omc *.install *.tmp
clean:
$(CLEAN) boot .config.omc .config.local.omc .omakedb* mk/*.omc .omake omake-boot$(EXE) lib/*.default download
if $(not $(defined FORCE_REALCLEAN))
FORCE_REALCLEAN = false
export
realclean: clean
svn_realclean $(if $(FORCE_REALCLEAN), -f) -i .omakedb -i .omakedb.lock -i .config -i .config.local
########################################################################
# Source code
#
.SUBDIRS: src ocamldep
########################################################################
# Packaging
#
.PHONY: rpm tar zip pkg dmg osxclean publish
VERSION=$(string $(cat version.txt))
RELEASE=0.devel
match $(VERSION)
case $'^\([^ ]*\)-\([^ ]*\)$'
VERSION=$1
RELEASE=$2
export
case $'^\([^ ]*\) '
VERSION=$1
export
BASENAME = omake-$(VERSION)-$(RELEASE)
rpm: version.txt make_rpm make_checkout
./make_rpm
zip: download/$(BASENAME).src.zip
tar: download/$(BASENAME).tar.gz
download/$(BASENAME).src.zip: make_zip make_checkout
./make_zip
download/$(BASENAME).tar.gz: make_tar make_checkout
./make_tar
dmg: version.txt
./make_dmg dmg
pkg: version.txt
./make_dmg pkg
osxclean: version.txt
./make_dmg clean
publish: download/$(BASENAME).src.zip download/$(BASENAME).tar.gz
rsync --progress --stats -lrt $^ mojave.caltech.edu\:/home/mojave/public_html/download/omake
omake.spec: omake.spec.in
echo $"%define index $(RELEASE)" > $@
echo $"Version: $(VERSION)" >> $@
cat $< >> $@
.DEFAULT: omake.spec
########################################################################
# Documentation
#
.PHONY: txt info html tex doc
doc: txt info html tex
.SUBDIRS: doc
########################################################################
# Standard library
#
.SUBDIRS: $(subdirs C, lib)
%.install: %.om $(GENMAGIC)$(EXE) $(VERSION_TXT)
$(GENMAGIC) -o $@ --version $(VERSION_TXT) --root $<
clean:
$(CLEAN)
STDLIBFILES = $(find lib -name *.om)
INSTALLFILES = $(replacesuffixes .om, .install, $(STDLIBFILES))
STDLIBNAMES = $(removesuffix .om, $(in lib, $(STDLIBFILES)))
BOOTFILES[] =
lib/boot/License
lib/boot/Default
DEFAULTFILES[] =
lib/OMakeroot.default
lib/OMakefile.default
lib/OMakeroot.default: $(BOOTFILES)
fprint($@, $(OMakeroot))
lib/OMakefile.default: $(BOOTFILES)
fprint($@, $(OMakefile))
########################################################################
# Installation
#
name =
all: $(DEFAULTFILES) $(INSTALLFILES)
install: $(DEFAULTFILES) $(INSTALLFILES)
mkdir -p $(INSTALL_LIBDIR)/omake
cp -f -m 444 $(DEFAULTFILES) $(INSTALL_LIBDIR)/omake/
foreach(name, $(STDLIBNAMES))
node = $(file $(INSTALL_LIBDIR)/omake/$(name).om)
mkdir -p $(dirof $(node))
cp -f -m 444 lib/$(name).install $(node)
########################################################################
# Testing
#
.PHONY: check
.SUBDIRS: test
|