Permalink
Browse files

build using a plain Makefile instead of rebar

  • Loading branch information...
1 parent 28e7d13 commit e8ffadf16bb0b243b82a50123ba60f1fdf7fc53e Helge Sychla committed Feb 9, 2011
Showing with 46 additions and 28 deletions.
  1. +1 −0 Emakefile
  2. +35 −23 Makefile
  3. +10 −0 c_src/Makefile
  4. +0 −5 rebar.config
View
@@ -0,0 +1 @@
+{'src/*',[{outdir, "ebin"}, {i, "include"}]}.
View
@@ -1,23 +1,35 @@
-
-REBAR=$(shell which rebar || echo ./rebar)
-
-all: dirs compile
-
-./rebar:
- erl -noshell -s inets start \
- -eval 'httpc:request(get, {"http://hg.basho.com/rebar/downloads/rebar", []}, [], [{stream, "./rebar"}])' \
- -s init stop
- chmod +x ./rebar
-
-dirs:
- @mkdir -p priv/tmp
-
-compile: $(REBAR)
- @$(REBAR) compile
-
-clean: $(REBAR)
- @$(REBAR) clean
-
-deps: $(REBAR)
- @$(REBAR) get-deps
-
+# __ __ _
+# / /__________ __ _____ / /___ (_)___ ____ _
+# / __/ ___/ __ `/ | / / _ \/ / __ \/ / __ \/ __ `/
+# / /_/ / / /_/ /| |/ / __/ / /_/ / / / / / /_/ /
+# \__/_/ \__,_/ |___/\___/_/ .___/_/_/ /_/\__, /
+# /_/ /____/
+#
+# Copyright (c) Travelping GmbH <info@travelping.com>
+
+ERL = erl
+ERLC = erlc
+
+APPLICATION = tp_json_rpc
+SRC_DIR = $(CURDIR)/src
+EBIN_DIR = $(CURDIR)/ebin
+INCLUDE_DIR = $(CURDIR)/include
+TEST_DIR = $(CURDIR)/test
+TEST_LOG_DIR = $(CURDIR)/test-log
+
+.PHONY: all clean shell
+
+all:
+ $(MAKE) -C c_src
+ $(ERL) -pa $(EBIN_DIR) -noinput \
+ -eval "case make:all() of up_to_date -> halt(0); error -> halt(1) end."
+
+clean:
+ $(MAKE) -C c_src clean
+ rm -f $(EBIN_DIR)/*.beam
+ rm -fr ${TEST_DIR}/*.beam
+ rm -f doc/edoc-info doc/*.html doc/*.css doc/*.png
+ rm -fr ${TEST_LOG_DIR}/*
+
+shell: all
+ $(ERL) -pa $(EBIN_DIR)
View
@@ -0,0 +1,10 @@
+CFLAGS +=-fPIC -I. $(shell erl -noinput -eval 'io:format("-I~s -I~s/erts-~s/include", [code:lib_dir(erl_interface, include), code:root_dir(), erlang:system_info(version)]), halt(0).')
+
+all: ../priv/gen_socket.so
+
+clean:
+ rm -f ../priv/*.so
+ rm -f *.o
+
+../priv/gen_socket.so: gen_socket.o
+ $(CC) $(LDFLAGS) -fPIC -shared -lei -lerl_interface gen_socket.o -o ../priv/gen_socket.so
View
@@ -1,5 +0,0 @@
-{so_name, "gen_socket.so"}.
-
-{port_sources, ["c_src/gen_socket.c"]}.
-
-{port_cleanup_script, "rm c_src/*.a c_src/*.o"}.

0 comments on commit e8ffadf

Please sign in to comment.