1 #**********************************************************
2 # Build the .beam erlang VM files
3 # Makefile for irc bot (based on orbitz bot)
4 # Laughing man IRC library uses orbitz
9 #**********************************************************
11 TOPDIR
:= $(shell pwd
)
12 DATE
= $(shell date
+%Y
%m
%d
)
15 APPLICATION
= laughingman
22 IRC_LIB_SRC
= $(IRC_LIB
)/src
24 TEST_DIR
= .
/test/erlang
25 TEST_DIR_SRC
= $(TEST_DIR
)/src
27 TEST_SERV_DIR
= .
/test/ircserver
/src
28 TEST_SERV_SRC
= .
/test/ircserver
/src
36 SED
= $(shell which sed
)
38 TMP
= $(wildcard *~
) $(wildcard src
/*~
) $(wildcard inc
/*~
)
39 INC_FILES
= $(wildcard $(INC
)/*.hrl
)
40 SRC
= $(wildcard $(ESRC
)/*.erl
)
41 CONFFILES
= conf
/config.xml
$(wildcard conf
/*fortune
)
43 TARGET
= $(addsuffix .beam
, $(basename \
44 $(addprefix $(EBIN
)/, $(notdir $(SRC
)))))
46 LIB_TARGET_OBJS
= $(EBIN
)/bot_app.beam \
47 $(EBIN
)/bot_manager.beam \
48 $(EBIN
)/bot_supervisor.beam \
50 $(EBIN
)/dict_proc.beam \
51 $(EBIN
)/factoid_file_gen.beam \
52 $(EBIN
)/irc_bot.beam \
53 $(EBIN
)/irc_lib.beam \
54 $(EBIN
)/irc_lookup.beam \
55 $(EBIN
)/msg_dispatch.beam \
57 $(EBIN
)/plugin_manager.beam \
58 $(EBIN
)/rec_convert.beam \
61 TEST_OBJS
= $(EBIN
)/eunit_examples.beam \
62 $(EBIN
)/test_suite.beam \
63 $(EBIN
)/test_parse_data.beam \
64 $(EBIN
)/simple_irc_lib.beam \
65 $(EBIN
)/test_simple_server.beam \
66 $(EBIN
)/test_shutdown_server.beam \
68 TEST_SERVER_OBJS
= $(EBIN
)/server_lib.beam \
69 $(EBIN
)/functional_test_server.beam \
70 $(EBIN
)/client_handler.beam \
71 $(EBIN
)/simple_server_example.beam \
73 ${APPLICATION}: $(TARGET
) $(LIB_TARGET_OBJS
) $(TEST_OBJS
) $(TEST_SERVER_OBJS
)
75 all: clean ${APPLICATION}
78 -rm -vf
$(TARGET
) $(TMP
)
79 -rm -vf erl_crash.dump
82 ebin
/%.beam
: $(IRC_LIB_SRC
)/%.erl
83 $(ERLC
) $(OPT
) -I
$(INC
) -o ebin
$<
85 ebin
/%.beam
: $(TEST_DIR_SRC
)/%.erl
86 $(ERLC
) $(OPT
) -I
$(INC
) -o ebin
$<
88 ebin
/%.beam
: $(TEST_SERV_SRC
)/%.erl
89 $(ERLC
) $(OPT
) -I
$(INC
) -o ebin
$<
91 ebin
/%.beam
: $(ESRC
)/%.erl
92 $(ERLC
) $(OPT
) -I
$(INC
) -o ebin
$<
94 # Start the erl emulator process with the social stats module
97 $(ERL
) -noshell
-pa
$(TOPDIR
)/ebin
-s laughingman start_laughingman
-s erlang halt
100 # Start the test IRC server, delay for 5 seconds and start the client.
101 tests
: $(APPLICATION
)
102 # Run the basic tests and then the server test.
103 # Ideally, test modules will have a 'run_tests' function.
104 $(ERL
) -noshell
-pa
$(TOPDIR
)/ebin
-s simple_server_example simple_server_lib
-s erlang halt
&
106 $(ERL
) -noshell
-pa
$(TOPDIR
)/ebin
-s test_suite run_tests
-s erlang halt