erlang的makefile编译问题

本文介绍了作者在学习Erlang过程中遇到的makefile编译问题,特别是针对《Erlang程序设计》书中Mac OS X环境下makefile在Linux上的不适用性。作者分享了自己修改makefile的过程,包括删除不必要的模块,调整gcc命令以适应erlang安装路径,最终成功编译。通过这次经历,作者不仅解决了问题,还深入学习了make和makefile。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

最近一直在看erlang程序设计,但是一直卡在第十五章的makefile那里(make和gcc菜鸟一枚)。弄了几天终于把问题解决了。

先感谢一下这篇博客“对在erlang中的makefile一些解释” 。下面是解释及问题解决:

由于作者在《Erlang程序设计》书中提供的makefile是在Mac OS X系统中测试的,并没有linux版本,所以就想着自己捣鼓一个makefile出来。但由于之前都没有使用makefile编译过程序,所以就花了一些时间去学习make。先上我修改后的makefile文件:

.SUFFIXES: .erl .beam

.erl.beam:
	erlc -W $<

MODS = example1

all: ${MODS:%=%.beam} example1 example1_drv.so

example1: example1.c erl_comm.c example1_driver.c
        gcc -o example1 example1.c erl_comm.c example1_driver.c
 
example1_drv.so:  example1.c
        gcc -I /opt/erlang/lib/erlang/usr/include\-o example1_drv.so example1.c example1_driver.c erl_comm.c

clean:
        rm example1 example1_drv.so *.beam


 

其中࿰

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值