Makefile仅编译第一个文件和一个makefile指令 [英] Makefile compile only the first file one makefile instructions

查看:111
本文介绍了Makefile仅编译第一个文件和一个makefile指令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

f1: f1.cpp f.h  
    g++ -c -Wall -g f1.cpp

f2: f2.cpp f.h  
    g++ -c -Wall -g f.cpp

此makefile无法将f2.cpp编译为f2.o 它只编译第一个文件,知道为什么吗?

This makefile does not compile f2.cpp to f2.o It only compile the first file, any idea why?

推荐答案

因为仅制作

Because make only processes the first target (goal). To do both add this as the first rule:

all: f1 f2

这篇关于Makefile仅编译第一个文件和一个makefile指令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆