[英]generate a.out from lex file using makefile
我有auto.lex
,我想生成此文件的a.out
。
我試過了 -
a.out: lex.yy.c
gcc -c lex.yy.c
lex.yy.c: auto.lex
flex -c auto.lex
但它沒有用。
編輯:
變成 -
a.out: lex.yy.c
gcc lex.yy.c
lex.yy.c: auto.lex
flex auto.lex
並固定。
lex文件的推薦后綴為.l
。 GNU make具有內置規則.lc
,該規則從lex源創建C代碼。 因此,如果要從auto.l
創建可執行文件auto
,則根本不需要makefile。 只需輸入make auto
:
$ make auto lex -t auto.l > auto.c cc -c -o auto.o auto.c cc auto.o -lfl -o auto rm auto.o auto.c
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.