aboutsummaryrefslogtreecommitdiffstats
path: root/src/Makefile
blob: c29b76f2edbcc995bd15146dc4a704635afe2a18 (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
CFLAGS =	-I/usr/local/mysql/include \
		-I$(HOME)/lib/erlang/lib/erl_interface-3.5.5.3/include \
		-O2 -g -Wall -Werror
LDFLAGS =	-L/usr/local/mysql/lib \
		-L$(HOME)/lib/erlang/lib/erl_interface-3.5.5.3/lib \
		-lerl_interface -lei
EFLAGS =	-W +debug_info

PRIVDIR =	../priv
BEAMDIR =	../ebin

BINS =		$(PRIVDIR)/mysqlerl $(BEAMDIR)/mysqlerl.app
MYSQLERLOBJS =	io.o log.o msg.o mysqlerl.o
BEAMS =		mysqlerl.beam mysqlerl_app.beam mysqlerl_connection.beam \
		mysqlerl_connection_sup.beam
LIBS =		-lmysqlclient

all:	$(PRIVDIR) $(BEAMDIR) $(BINS)

clean:
	rm -rf *.o *.beam
	rm -rf $(BINS) $(MYSQLERLOBJS) $(BEAMS) $(BEAMDIR)/mysqlerl.app

%.beam: %.erl
	erlc $(EFLAGS) $<

$(PRIVDIR)/mysqlerl: $(PRIVDIR) $(MYSQLERLOBJS)
	$(CC) -o $@ $(LDFLAGS) $(MYSQLERLOBJS) $(LIBS)

$(BEAMDIR)/mysqlerl.app: $(BEAMDIR) $(BEAMS)
	cp $(BEAMS) $(BEAMDIR)
	cp mysqlerl.app $(BEAMDIR)

$(PRIVDIR):
	mkdir -p $(PRIVDIR)

$(BEAMDIR):
	mkdir -p $(BEAMDIR)