[erlang-questions] try horse, got undefined parse transform error
Loïc Hoguin
essen@REDACTED
Thu Apr 9 11:54:26 CEST 2015
Not too sure what you are doing there.
This should work all in the Makefile file, if using horse's erlang.mk:
PROJECT = test
include deps/horse/erlang.mk
deps/horse:
git clone -n -- https://github.com/extend/horse $(DEPS_DIR)/horse
cd $(DEPS_DIR)/horse ; git checkout -q master
$(MAKE) -C $(DEPS_DIR)/horse
perfs: ERLC_OPTS += -DPERF=1 +'{parse_transform, horse_autoexport}'
perfs: clean deps deps/horse app
$(gen_verbose) erl -noshell -pa ebin deps/horse/ebin \
-eval 'horse:app_perf($(PROJECT)), init:stop().'
If you use a more recent erlang.mk it's much simpler, see
https://github.com/ninenines/cowlib/blob/master/Makefile for example.
On 04/09/2015 12:46 PM, Fisher wrote:
>
> Here is my test:
>
> makefile:
> PROJECT = test
> include erlang.mk
>
> erlang.mk
> include deps/horse/erlang.mk
>
> .PHONY: all start clean
>
> INCLUDE = "include"
>
> EBIN = "ebin"
>
> HORSE = "deps/horse/ebin"
>
> DEPS_DIR = "deps"
>
> MODULE = "test02.erl"
>
> all:
> erlc -o ${EBIN} -I ${INCLUDE} \
> src/*.erl
>
> start:
> erl -pa ${EBIN} ${HORSE} \
> -eval 'horse:app_perf(horse), init:stop().'
>
> deps/horse:
> git clone -n -- https://github.com/extend/horse $(DEPS_DIR)/horse
> cd $(DEPS_DIR)/horse; git checkout -q master
> $(MAKE) -C $(DEPS_DIR)/horse
>
> perfs: ERLC_OPTS += -DPERF=1 +'{parse_transform, horse_autoexport}'
> %perfs: clean deps deps/horse app
> perfs: deps deps/horse app
> $(gen_verbose) erl -noshell -pa ebin deps/horse/ebin \
> -eval 'horse:app_perf($(PROJECT)), init:stop().'
>
>
> #clean:
> # rm -rf ebin/*.beam
>
> and my test:
> -module(test01).
> -compile({parse_transform, horse_autoexport}).
> -export([test_fun/0,
> horse_do_nothing/0,
> horse_rfc2019/0
> ]).
>
> -include("test.hrl").
>
> test_fun() ->
> io:format("this is Test01/test01~n"), ok.
>
>
> horse_do_nothing() ->
> io:format("test01 running horse test~n"),
> ok.
>
> horse_rfc2019() ->
> horse:repeat(100000, test_fun()).
>
>
>
>
>
> At 2015-04-09 17:33:29, "Loïc Hoguin" <essen@REDACTED <mailto:essen@REDACTED>> wrote:
>>Show me the Makefile.
>>
>>On 04/09/2015 12:28 PM, Fisher wrote:
>>> Thanks for your answer!
>>> and i already added an include to my makefile like this:
>>> include deps/horse/erlang.mk !!!
>>> and the error still here -.-
>>>
>>>
>>>
>>>
>>>
>>>
>>> At 2015-04-09 17:24:02, "Loïc Hoguin" <essen@REDACTED <mailto:essen@REDACTED>> wrote:
>>>>Hey,
>>>>
>>>>These instructions apply only if you use erlang.mk. For rebar I think
>>>>you will need to add the project as a dependency and then the option to
>>>>use the parse_transform, though I am not sure on the details.
>>>>
>>>>Cheers,
>>>>
>>>>On 04/09/2015 10:28 AM, Fisher wrote:
>>>>> Hi, all!
>>>>> I am trying horse:https://github.com/extend/horse
>>>>> I got it in this folder: MyProject -> deps -> horse
>>>>> I added this in my makefile like the website says:
>>>>>
>>>>> deps/horse:
>>>>> git clone -n -- https://github.com/extend/horse$(DEPS_DIR)/horse
>>>>> cd $(DEPS_DIR)/horse ; git checkout -q master
>>>>> $(MAKE) -C $(DEPS_DIR)/horse
>>>>>
>>>>> perfs: ERLC_OPTS += -DPERF=1 +'{parse_transform, horse_autoexport}'
>>>>> perfs: clean deps deps/horse app
>>>>> $(gen_verbose) erl -noshell -pa ebin deps/horse/ebin \
>>>>> -eval 'horse:app_perf($(PROJECT)), init:stop().'
>>>>>
>>>>> then i compile: make perfs
>>>>> and i got this error:
>>>>>
>>>>> src/test01.erl: undefined parse transform 'horse_autoexport'
>>>>>
>>>>> i tried add {erl_opts, [{parse_transform, horse_autoexport}]} to my app file
>>>>> or i add -compile([{parse_transform, horse_autoexport}]) to test01.erl
>>>>> module
>>>>> but the error continue.
>>>>>
>>>>> anyone can help? thanks!
>>>>>
>>>>> _______________________________________________
>>>>> erlang-questions mailing list
>>>>>erlang-questions@REDACTED <mailto:erlang-questions@REDACTED>
>>>>> http://erlang.org/mailman/listinfo/erlang-questions
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> erlang-questions mailing list
>>>>>erlang-questions@REDACTED <mailto:erlang-questions@REDACTED>
>>>>> http://erlang.org/mailman/listinfo/erlang-questions
>>>>>
>>>>
>>>>--
>>>>Loïc Hoguin
>>>>http://ninenines.eu
>>>
>>
>>--
>>Loïc Hoguin
>>http://ninenines.eu
>
--
Loïc Hoguin
http://ninenines.eu
More information about the erlang-questions
mailing list