aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: b5d3c65c3a88402f5276aff1d32f7fe7b71a6f33 (plain)
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
# Jim makefile
#
# This is a simple Makefile as it is expected that most users are likely
# to embed Jim directly into their current build system. Jim is able to
# make use of dynamically loaded extensions on unix provided you have the
# dl library available. If not, set JIM_LIBS= on the make command line.
#
# make CC=gcc jim         builds a standard Jim binary using gcc.
# make CC=gcc LIBS= jim   avoids attempts to link in libdl.a
#
#

.SUFFIXES:
.SUFFIXES: .c .so .xo .o .dll
.PHONY: jim-aio-1.0.so

SHELL   = /bin/sh
RM      = rm -f
OPT     = -O2
LDFLAGS = $(PROFILE)
CFLAGS  = -Wall -Wwrite-strings -W $(OPT) -g $(PROFILE)
AR      = /usr/bin/ar
RANLIB  = /usr/bin/ranlib
LIBPATH =-L.
INSTALL = /usr/bin/install
INSTALL_PROGRAM= $(INSTALL)
INSTALL_DATA= $(INSTALL) -m 644
DESTDIR = /usr/local/bin/

PROGRAMS    = jim
JIM_OBJECTS = jim.o jimsh.o
LIBS        = -ldl

stopit:
	@echo "Use:"
	@echo "make jim       - to build the Jim interpreter"
	@echo "---"
	@echo "make aio       - to build only the ANSI I/O extension"
	@echo "---"
	@echo "make unix-ext  - to build the AIO, POSIX and SDL extensions"
	@echo "make posix     - to build only the POSIX extension"
	@echo "make sdl       - to build only the SDL extension"
	@echo "---"
	@echo "make win32-ext - to build the WIN32 and WIN32COM extensions"
	@echo "make win32     - to build only the WIN32 extension"
	@echo "make win32com  - to build only the WIN32COM extension"

all: $(DEFAULT_BUILD)

profile:
	@$(MAKE) clean jim PROFILE=-pg

.c.o:
	$(CC) -I. $(CFLAGS) $(DEFS) -c $< -o $@

.xo.so:
	rm -f $@
	$(LD) -G -z text -o $@ $< -ldl -lc

.c.xo:
	$(CC) -I. $(CFLAGS) $(DEFS) -fPIC -c $< -o $@

.o.dll:
	$(CC) -shared -o $@ $<

jim-win32com.dll: jim-win32com.o
	$(CC) -shared -o $@ $< -lole32 -luuid -loleaut32

jim-sdl.xo: jim-sdl.c
	$(CC)  `sdl-config --cflags` -I. $(CFLAGS) $(DEFS) -fPIC -c $< -o $@

jim-sdl.so: jim-sdl.xo
	rm -f $@
	$(LD) -G -z text -o $@ $< -ldl -lc -L/usr/local/lib -lSDL -lSDL_gfx -lpthread

jim: $(JIM_OBJECTS)
	$(CC) $(LDFLAGS) -o jim $(JIM_OBJECTS) $(LIBS)

posix: jim-posix-1.0.so
aio: jim-aio-1.0.so
sdl: jim-sdl-1.0.so
win32: jim-win32-1.0.dll
win32com: jim-win32com-1.0.dll
unix-extensions: posix aio sdl
win32-extensions: win32 win32com

jim-posix-1.0.so: jim-posix.xo
jim-aio-1.0.so: jim-aio.xo
jim-sdl-1.0.so: jim-sdl.xo
jim-win32-1.0.dll: jim-win32.o
jim-win32com-1.0.dll: jim-win32com.o

clean:
	$(RM) *.o *.so *.dll *.xo core .depend .*.swp gmon.out $(PROGRAMS)

test: jim
	./jim test.tcl
	./jim regtest.tcl

bench: jim
	./jim bench.tcl

dep:
	gcc -MM *.[ch] 2> /dev/null

TAGS: jim.h jim.c jim-posix.c jim-win32.c jim-win32com.c
	etags -o $@ $^

wc:
	wc -l jim.[ch]
	wc -l *.[ch]

clog:
	cvs2cl

commit:
	cvs2cl
	cvs commit

update:
	cvs update
	cvs2cl

bak:
	cp -f jim.c jim.c.orig
	cp -f jimsh.c jimsh.c.orig
	cp -f jim.h jim.h.orig

# Dependences
jim-aio.o: jim-aio.c jim.h
jim-posix.o: jim-posix.c jim.h
jim-sdl.o: jim-sdl.c jim.h
jim-win32com.o: jim-win32com.c jim.h
jim.o: jim.c jim.h
jimsh.o: jimsh.c jim.h