首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 操作系统 > UNIXLINUX >

那位老大帮忙 linux下有关问题

2012-04-05 
那位老大帮忙linux下问题学习linux,automake不能生成Makefile.in,导致不能make,求解方法。或者帮些一个脚本

那位老大帮忙 linux下问题
学习linux,automake不能生成Makefile.in,导致不能make,求解方法。或者帮些一个脚本,可以自动检测目录下的源文件,并编译运行。

[解决办法]
给你个 Makefie, 可以自己搜索并编译该目录下的所有文件。
binexec := binexec
subdirs := . src 

sources := $(foreach subdir, $(subdirs), $(wildcard $(subdir)/*.c))
headers := $(foreach subdir, $(subdirs), $(wildcard $(subdir)/*.h))

objects := $(sources:.c=.o)
deps := $(sources:.c=.d)

INCLUDE := $(addprefix -I, $(subdirs))
CFLAGS := -g
RM := rm -f
TAR := tar
GZIP := gzip
me := Makefile

all: $(binexec)

binexec:$(objects)
$(CC) -o $@ $(objects) $(LDFLAGS) $(LDLIBS)

dist:
pkg=`pwd`; tar cvf - $(me) $(sources) $(headers) \
| $(GZIP) -c > `basename $${pkg}`.tar.gz
clean:
$(RM) $(objects)
$(RM) $(deps)
$(RM) $(binexec)

-include $(deps)

热点排行