Bring assert() just after calloc(). Otherwise, it doesn't make
[jimtcl/wkoszek.git] / Makefile
blob8ec85bd4adf246ae9240ca739165016847efd1ed
1 # Jim makefile
3 # This is a simple Makefile as it is expected that most users are likely
4 # to embed Jim directly into their current build system. Jim is able to
5 # make use of dynamically loaded extensions on unix provided you have the
6 # dl library available. If not, set JIM_LIBS= on the make command line.
8 # make CC=gcc jim builds a standard Jim binary using gcc.
9 # make CC=gcc LIBS= jim avoids attempts to link in libdl.a
13 .SUFFIXES:
14 .SUFFIXES: .c .so .xo .o .dll
15 .PHONY: jim-aio-1.0.so
17 SHELL = /bin/sh
18 RM = rm -f
19 OPT = -Os
20 LDFLAGS = $(PROFILE)
21 CFLAGS = -Wall -pedantic -std=c99 -Wwrite-strings -W $(OPT) -g $(PROFILE)
22 AR = /usr/bin/ar
23 RANLIB = /usr/bin/ranlib
24 LIBPATH =-L.
25 INSTALL = /usr/bin/install
26 INSTALL_PROGRAM= $(INSTALL)
27 INSTALL_DATA= $(INSTALL) -m 644
28 DESTDIR = /usr/local/bin/
30 PROGRAMS = jim jim.exe
31 JIM_SRCS = jim.c
32 JIM_OBJECTS = jim.o jimsh.o
33 LIBS = -ldl
35 stopit:
36 @echo "Use:"
37 @echo "make jim - to build the Jim interpreter"
38 @echo "---"
39 @echo "make libjim - to build a shared library with Jim's API"
40 @echo "---"
41 @echo "make eventloop - to build only the event loop extension (.SO)"
42 @echo "make aio - to build only the ANSI I/O extension (.SO)"
43 @echo "make aio-dll - to build only the ANSI I/O extension (.DLL)"
44 @echo "---"
45 @echo "make unix-ext - to build the AIO, POSIX and SDL extensions"
46 @echo "make posix - to build only the POSIX extension"
47 @echo "make hwio - to build only Hardware IO extension"
48 @echo "make sdl - to build only the SDL extension"
49 @echo "make readline - to build only the READLINE extension"
50 @echo "---"
51 @echo "make win32-ext - to build the WIN32 and WIN32COM extensions"
52 @echo "make win32 - to build only the WIN32 extension"
53 @echo "make win32com - to build only the WIN32COM extension"
54 @echo ""
55 @echo "Note, if 'make jim' does not work try 'make jim LIBS=\"\"'"
56 @echo ""
57 @echo "For default Jim is compiled with -Os, if you need more"
58 @echo "speed try: 'make OPT=\"-O3 -fomit-frame-pointer\"' but"
59 @echo "this will result in a much larger binary."
61 all: $(DEFAULT_BUILD)
63 profile:
64 @$(MAKE) clean jim PROFILE=-pg
66 .c.o:
67 $(CC) -I. $(CFLAGS) $(DEFS) -c $< -o $@
69 .c.xo:
70 $(CC) -I. $(CFLAGS) $(DEFS) -fPIC -c $< -o $@
72 jim-win32-1.0.dll: im-win32.o
73 $(CC) -shared -o $@ $<
75 jim-aio-1.0.dll: jim-aio.o
76 $(CC) -shared -o $@ $<
78 jim-win32com-1.0.dll: jim-win32com.o
79 $(CC) -shared -o $@ $< -lole32 -luuid -loleaut32
81 jim-aio-1.0.so: jim-aio.xo
82 $(LD) -G -z text -o $@ $< $(LIBS) -lc
84 jim-posix-1.0.so: jim-posix.xo
85 $(LD) -G -z text -o $@ $< $(LIBS) -lc
87 jim-hwio-1.0.so: jim-hwio.xo
88 $(LD) -G -z text -o $@ $< $(LIBS) -lc
90 jim-eventloop-1.0.so: jim-eventloop.xo
91 $(LD) -G -z text -o $@ $< $(LIBS) -lc
93 jim-udp-1.0.so: jim-udp.xo
94 $(LD) -G -z text -o $@ $< $(LIBS) -lc
96 jim-sqlite-1.0.so: jim-sqlite.xo
97 $(LD) -G -z text -o $@ $< $(LIBS) -lc -lsqlite
99 jim-readline-1.0.so: jim-readline.xo
100 $(LD) -G -z text -o $@ $< $(LIBS) -lc -lreadline
102 jim-sdl.xo: jim-sdl.c
103 $(CC) `sdl-config --cflags` -I. $(CFLAGS) $(DEFS) -fPIC -c $< -o $@
105 jim-sdl-1.0.so: jim-sdl.xo
106 rm -f $@
107 $(LD) -G -z text -o $@ $< $(LIBS) -lc -L/usr/local/lib -lSDL -lSDL_gfx -lpthread
109 jim: $(JIM_OBJECTS)
110 $(CC) $(LDFLAGS) -o jim $(JIM_OBJECTS) $(LIBS)
112 libjim: libjim.so
114 libjim.so: $(JIM_SRCS)
115 $(CC) $(LDFLAGS) -fpic -fPIC -shared -o libjim.so $(JIM_SRCS) $(LIBS)
117 readline: jim-readline-1.0.so
118 posix: jim-posix-1.0.so
119 hwio: jim-hwio-1.0.so
120 eventloop: jim-eventloop-1.0.so
121 udp: jim-udp-1.0.so
122 sqlite: jim-sqlite-1.0.so
123 aio: jim-aio-1.0.so
124 aio-dll: jim-aio-1.0.dll
125 sdl: jim-sdl-1.0.so
126 win32: jim-win32-1.0.dll
127 win32com: jim-win32com-1.0.dll
128 unix-extensions: posix aio sdl hwio
129 win32-extensions: win32 win32com
131 clean:
132 $(RM) *.o *.so *.dll *.xo core .depend .*.swp gmon.out $(PROGRAMS)
134 test: jim
135 ./jim test.tcl
136 ./jim regtest.tcl
138 bench: jim
139 ./jim bench.tcl
141 dep:
142 gcc -MM *.[ch] 2> /dev/null
144 TAGS: jim.h jim.c jim-posix.c jim-hwio.c jim-win32.c jim-win32com.c
145 etags -o $@ $^
148 wc -l jim.[ch]
149 wc -l *.[ch]
151 clog:
152 cvs2cl
154 commit:
155 cvs2cl
156 cvs commit
158 update:
159 cvs update
160 cvs2cl
162 bak:
163 cp -f jim.c jim.c.orig
164 cp -f jimsh.c jimsh.c.orig
165 cp -f jim.h jim.h.orig
167 # Dependences
168 jim-aio.o: jim-aio.c jim.h
169 jim-posix.o: jim-posix.c jim.h
170 jim-hwio.o: jim-hwio.c jim-hwio.inoutblock.h jim.h
171 jim-sdl.o: jim-sdl.c jim.h
172 jim-win32com.o: jim-win32com.c jim.h
173 jim.o: jim.c jim.h
174 jimsh.o: jimsh.c jim.h