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
14 .SUFFIXES
: .c .so .xo .o .dll
15 .PHONY
: jim-aio-1.0.so
21 CFLAGS
= -Wall
-pedantic
-std
=c99
-Wwrite-strings
-W
$(OPT
) -g
$(PROFILE
)
23 RANLIB
= /usr
/bin
/ranlib
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
32 JIM_OBJECTS
= jim.o jimsh.o
37 @echo
"make jim - to build the Jim interpreter"
39 @echo
"make libjim - to build a shared library with Jim's API"
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)"
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"
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"
55 @echo
"Note, if 'make jim' does not work try 'make jim LIBS=\"\"'"
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."
64 @
$(MAKE
) clean jim PROFILE
=-pg
67 $(CC
) -I.
$(CFLAGS
) $(DEFS
) -c
$< -o
$@
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
107 $(LD
) -G
-z text
-o
$@
$< $(LIBS
) -lc
-L
/usr
/local
/lib
-lSDL
-lSDL_gfx
-lpthread
110 $(CC
) $(LDFLAGS
) -o jim
$(JIM_OBJECTS
) $(LIBS
)
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
122 sqlite
: jim-sqlite-1.0.so
124 aio-dll
: jim-aio-1.0.dll
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
132 $(RM
) *.o
*.so
*.dll
*.xo core .depend .
*.swp gmon.out
$(PROGRAMS
)
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
163 cp
-f jim.c jim.c.orig
164 cp
-f jimsh.c jimsh.c.orig
165 cp
-f jim.h jim.h.orig
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
174 jimsh.o
: jimsh.c jim.h