Image and Font updates
[io/quag.git] / Makefile
blob82f57d5d222fa230a75d303122e6a502165bdde1
1 INSTALL_PREFIX ?= /usr/local
3 SYS ?= $(shell uname -s)
5 NEEDS_DL := Darwin Linux SunOS syllable
6 ifneq (,$(findstring $(SYS),$(NEEDS_DL)))
7 LFLAGS +=-ldl
8 endif
10 NEEDS_M := FreeBSD Linux NetBSD
11 ifneq (,$(findstring $(SYS),$(NEEDS_M)))
12 LFLAGS +=-lm
13 endif
15 #NEEDS_PTHREAD := FreeBSD Linux NetBSD
16 #ifneq (,$(findstring $(SYS),$(NEEDS_PTHREAD)))
17 #LFLAGS +=-lpthread
18 #endif
20 DLL_SUFFIX := so
21 DLL_COMMAND := -shared -Wl,-soname="libiovmall.so"
22 FLAT_NAMESPACE :=
24 LINKDLL := $(CC)
25 LINKDLLOUTFLAG := -o
26 LINKDIRFLAG := -L
27 LINKLIBFLAG := -l
28 DLL_LIB_SUFFIX :=
29 CCOUTFLAG := -o
30 AROUTFLAG :=
31 RANLIB ?= ranlib
32 AR ?= ar
33 ARFLAGS := rcu
35 ifeq ($(SYS),Darwin)
36 DLL_SUFFIX := dylib
37 DLL_COMMAND := -dynamiclib
38 FLAT_NAMESPACE := -flat_namespace
39 endif
41 ifneq (,$(findstring CYGW,$(SYS)))
42 DLL_SUFFIX := dll
43 BINARY_SUFFIX := .exe
44 endif
46 ifneq (,$(findstring MINGW,$(SYS)))
47 DLL_SUFFIX := dll
48 BINARY_SUFFIX := .exe
49 endif
51 ifneq (,$(findstring Windows,$(SYS)))
52 CC := cl -nologo
53 LINKDLL := link
54 LINKDLLOUTFLAG :=-out:
55 DLL_SUFFIX := dll
56 DLL_COMMAND := -dll -debug /INCREMENTAL:NO -subsystem:CONSOLE
57 DLL_EXTRA_LIBS := ws2_32.lib
58 FLAT_NAMESPACE :=
59 AR := link -lib
60 ARFLAGS :=
61 AROUTFLAG := -out:
62 VMALL := vmall_
63 BINARY_SUFFIX := .exe
64 endif
66 ###########################
68 date := $(shell date +'%Y-%m-%d')
70 #libs := $(shell ls libs)
71 libs := basekit coroutine garbagecollector iovm
73 all: addons
75 testaddon:
76 ./_build/binaries/io_static$(BINARY_SUFFIX) addons/$(addon)/tests/run.io
78 vm:
79 for dir in $(libs); do INSTALL_PREFIX=$(INSTALL_PREFIX) $(MAKE) -C libs/$$dir; done
80 $(MAKE) vmlib
81 cd tools; $(MAKE)
82 mkdir -p _build/binaries || true
83 cp tools/_build/binaries/* _build/binaries
85 addons: vm
86 ./_build/binaries/io_static$(BINARY_SUFFIX) build.io
87 @if [ -f errors ]; then cat errors; rm errors; fi
89 vmlib:
90 mkdir -p _build || true
91 mkdir -p _build/dll || true
92 $(LINKDLL) $(DLL_COMMAND) $(LINKDLLOUTFLAG)_build/dll/libiovmall.$(DLL_SUFFIX) libs/*/_build/$(VMALL)objs/*.o $(LFLAGS) $(DLL_EXTRA_LIBS)
93 mkdir -p _build/lib || true
94 $(AR) $(ARFLAGS) $(AROUTFLAG)_build/lib/libiovmall.a\
95 libs/*/_build/$(VMALL)objs/*.o
96 mkdir -p _build/headers || true
97 cp libs/*/_build/headers/* _build/headers
99 # Unlink the io binary before copying so running Io processes will keep running
100 install:
101 umask 022
102 mkdir -p $(INSTALL_PREFIX)/bin || true
103 mkdir -p $(INSTALL_PREFIX)/lib || true
104 rm -f $(INSTALL_PREFIX)/bin/io$(BINARY_SUFFIX)
105 cp _build/binaries/io$(BINARY_SUFFIX) $(INSTALL_PREFIX)/bin || true
106 chmod ugo+rx $(INSTALL_PREFIX)/bin/io$(BINARY_SUFFIX)
107 cp _build/binaries/io_static$(BINARY_SUFFIX) $(INSTALL_PREFIX)/bin
108 chmod ugo+rx $(INSTALL_PREFIX)/bin/io_static$(BINARY_SUFFIX) || true
109 cp _build/dll/* $(INSTALL_PREFIX)/lib || true
110 cp _build/lib/* $(INSTALL_PREFIX)/lib || true
111 rm -rf $(INSTALL_PREFIX)/lib/io || true
112 mkdir -p $(INSTALL_PREFIX)/lib/io || true
113 cp -fR addons $(INSTALL_PREFIX)/lib/io
114 chmod -R ugo+rX $(INSTALL_PREFIX)/lib/io
116 linkInstall:
117 mkdir -p $(INSTALL_PREFIX)/bin || true
118 ln -sf `pwd`/_build/binaries/io$(BINARY_SUFFIX) $(INSTALL_PREFIX)/bin
119 chmod ugo+rx $(INSTALL_PREFIX)/bin/io
120 ln -sf `pwd`/_build/binaries/io_static$(BINARY_SUFFIX) $(INSTALL_PREFIX)/bin
121 chmod ugo+rx $(INSTALL_PREFIX)/bin/io_static$(BINARY_SUFFIX)
122 ln -sf `pwd`/_build/dll/* $(INSTALL_PREFIX)/lib
123 ln -sf `pwd`/_build/lib/* $(INSTALL_PREFIX)/lib
124 rm -rf $(INSTALL_PREFIX)/lib/io || true
125 mkdir -p $(INSTALL_PREFIX)/lib/io || true
126 ln -s `pwd`/addons $(INSTALL_PREFIX)/lib/io/addons
127 chmod -R ugo+rX $(INSTALL_PREFIX)/lib/io
129 uninstall:
130 rm -rf $(INSTALL_PREFIX)/lib/io
131 rm $(INSTALL_PREFIX)/bin/io
132 rm $(INSTALL_PREFIX)/bin/io_static$(BINARY_SUFFIX)
133 rm $(INSTALL_PREFIX)/lib/libiovmall.*
135 doc:
136 ./_build/binaries/io_static$(BINARY_SUFFIX) build.io docs
138 cleanDocs:
139 ./_build/binaries/io_static$(BINARY_SUFFIX) build.io cleanDocs
141 clean:
142 for dir in $(libs); do \
143 $(MAKE) -C libs/$$dir clean; \
144 done
146 cd tools; $(MAKE) cleanDocs; cd ..
147 ./_build/binaries/io_static$(BINARY_SUFFIX) build.io clean || true
148 -rm -f IoBindingsInit.*
149 -rm -rf _build
150 -rm -rf projects/osx/build
151 -rm -rf projects/osxvm/build
152 cd tools; $(MAKE) clean
154 testvm:
155 cd tools; make test
157 testaddons:
158 _build/binaries/io$(BINARY_SUFFIX) build.io runUnitTests
160 test:
161 $(MAKE) testvm
162 $(MAKE) testaddons
164 dist:
165 -rm -f Io-*.tar.gz
166 echo "#define IO_VERSION_NUMBER "$(shell date +'%Y%m%d') > libs/iovm/source/IoVersion.h
167 #git add libs/iovm/source/IoVersion.h
168 #git commit -q --no-verify -m "setting version string for release"
169 git archive --format=tar --prefix=Io-$(date)/ HEAD | gzip > Io-$(date).tar.gz
170 ls -al Io-$(date).tar.gz
172 metrics:
173 ls -1 libs/iovm/source/*.c | io -e 'File standardInput readLines map(asFile contents occurancesOfSeq(";")) sum .. " iovm"'
174 ls -1 libs/basekit/source/*.c | io -e 'File standardInput readLines map(asFile contents occurancesOfSeq(";")) sum .. " basekit"'
175 ls -1 libs/coroutine/source/*.c | io -e 'File standardInput readLines map(asFile contents occurancesOfSeq(";")) sum .. " libcoroutine"'
176 ls -1 libs/*/source/*.c | io -e 'File standardInput readLines map(asFile contents occurancesOfSeq(";")) sum .. " total in core"'
178 aptget:
179 _build/binaries/io$(BINARY_SUFFIX) build.io aptget
181 emerge:
182 _build/binaries/io$(BINARY_SUFFIX) build.io emerge
184 port:
185 _build/binaries/io$(BINARY_SUFFIX) build.io port
187 urpmi:
188 _build/binaries/io$(BINARY_SUFFIX) build.io urpmi
190 .DEFAULT:
191 ./_build/binaries/io_static$(BINARY_SUFFIX) build.io -a $@