aboutsummaryrefslogtreecommitdiffstats
path: root/src/Makefile
blob: a8d20208b51b49327b80e821eb2c993d81860b75 (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
ERLINTERFACE = 	erl_interface-3.5.5.3
MYSQLINC =	/opt/local/include/mysql5/mysql
MYSQLLIB =	/opt/local/lib/mysql5/mysql

CFLAGS =	-I$(MYSQLINC) \
		-I$(HOME)/lib/erlang/lib/$(ERLINTERFACE)/include \
		-O2 -g -Wall -Werror
LDFLAGS =	-L$(MYSQLLIB) \
		-L$(HOME)/lib/erlang/lib/$(ERLINTERFACE)/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 mysqlerl_port.beam          \
		mysqlerl_port_sup.beam mysqlerl_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)