Removing commented out methods from IoFile. Code was moved to IoObject.
[io/quag.git] / Makefile
blobfcf5350d280cae0e0e8f8c004b1a10287e26b194
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,lib} || true
103 rm -f $(INSTALL_PREFIX)/bin/io$(BINARY_SUFFIX)
104 cp _build/binaries/io$(BINARY_SUFFIX) $(INSTALL_PREFIX)/bin || true
105 chmod ugo+rx $(INSTALL_PREFIX)/bin/io$(BINARY_SUFFIX)
106 cp _build/binaries/io_static$(BINARY_SUFFIX) $(INSTALL_PREFIX)/bin
107 chmod ugo+rx $(INSTALL_PREFIX)/bin/io_static$(BINARY_SUFFIX) || true
108 cp _build/dll/* $(INSTALL_PREFIX)/lib || true
109 cp _build/lib/* $(INSTALL_PREFIX)/lib || true
110 rm -rf $(INSTALL_PREFIX)/lib/io || true
111 mkdir -p $(INSTALL_PREFIX)/lib/io || true
112 cp -fR addons $(INSTALL_PREFIX)/lib/io
113 chmod -R ugo+rX $(INSTALL_PREFIX)/lib/io
115 linkInstall:
116 mkdir -p $(INSTALL_PREFIX)/bin || true
117 ln -sf `pwd`/_build/binaries/io$(BINARY_SUFFIX) $(INSTALL_PREFIX)/bin
118 chmod ugo+rx $(INSTALL_PREFIX)/bin/io
119 ln -sf `pwd`/_build/binaries/io_static$(BINARY_SUFFIX) $(INSTALL_PREFIX)/bin
120 chmod ugo+rx $(INSTALL_PREFIX)/bin/io_static$(BINARY_SUFFIX)
121 ln -sf `pwd`/_build/dll/* $(INSTALL_PREFIX)/lib
122 ln -sf `pwd`/_build/lib/* $(INSTALL_PREFIX)/lib
123 rm -rf $(INSTALL_PREFIX)/lib/io || true
124 mkdir -p $(INSTALL_PREFIX)/lib/io || true
125 ln -s `pwd`/addons $(INSTALL_PREFIX)/lib/io/addons
126 chmod -R ugo+rX $(INSTALL_PREFIX)/lib/io
128 uninstall:
129 rm -rf $(INSTALL_PREFIX)/lib/io
130 rm $(INSTALL_PREFIX)/bin/io
131 rm $(INSTALL_PREFIX)/bin/io_static$(BINARY_SUFFIX)
132 rm $(INSTALL_PREFIX)/lib/libiovmall.*
134 doc:
135 ./_build/binaries/io_static$(BINARY_SUFFIX) build.io docs
137 cleanDocs:
138 ./_build/binaries/io_static$(BINARY_SUFFIX) build.io cleanDocs
140 clean:
141 for dir in $(libs); do \
142 $(MAKE) -C libs/$$dir clean; \
143 done
145 cd tools; $(MAKE) cleanDocs; cd ..
146 ./_build/binaries/io_static$(BINARY_SUFFIX) build.io clean || true
147 -rm -f IoBindingsInit.*
148 -rm -rf _build
149 -rm -rf projects/osx/build
150 -rm -rf projects/osxvm/build
151 cd tools; $(MAKE) clean
153 testvm:
154 cd tools; make test
156 testaddons:
157 _build/binaries/io$(BINARY_SUFFIX) build.io runUnitTests
159 test:
160 $(MAKE) testvm
161 $(MAKE) testaddons
163 dist:
164 -rm -f Io-*.tar.gz
165 echo "#define IO_VERSION_NUMBER "$(shell date +'%Y%m%d') > libs/iovm/source/IoVersion.h
166 #git add libs/iovm/source/IoVersion.h
167 #git commit -q --no-verify -m "setting version string for release"
168 git archive --format=tar --prefix=Io-$(date)/ HEAD | gzip > Io-$(date).tar.gz
169 ls -al Io-$(date).tar.gz
171 metrics:
172 ls -1 libs/iovm/source/*.c | io -e 'File standardInput readLines map(asFile contents occurancesOfSeq(";")) sum .. " iovm"'
173 ls -1 libs/basekit/source/*.c | io -e 'File standardInput readLines map(asFile contents occurancesOfSeq(";")) sum .. " basekit"'
174 ls -1 libs/coroutine/source/*.c | io -e 'File standardInput readLines map(asFile contents occurancesOfSeq(";")) sum .. " libcoroutine"'
175 ls -1 libs/*/source/*.c | io -e 'File standardInput readLines map(asFile contents occurancesOfSeq(";")) sum .. " total in core"'
177 aptget:
178 _build/binaries/io$(BINARY_SUFFIX) build.io aptget
180 emerge:
181 _build/binaries/io$(BINARY_SUFFIX) build.io emerge
183 port:
184 _build/binaries/io$(BINARY_SUFFIX) build.io port
186 urpmi:
187 _build/binaries/io$(BINARY_SUFFIX) build.io urpmi
189 .DEFAULT:
190 ./_build/binaries/io_static$(BINARY_SUFFIX) build.io -a $@