projectroot/
|
+------------------------------+----------------------------+
| | |
include/ libs/ helloworld/
| | |
shader_utils.h shader_utils.c triangle.c
项目根目录下有三个目录。helloworld 目录包含 triangle.c,它依赖于 shader_utils.h(在 projectroot/include 下),其定义在 projectroot/libs 下。这是我的 make 文件。这有什么问题。
#!bin/sh
CC=gcc
LDLIBS=-lglut -lGLEW -lGL
ROOT=/media/programming/experiments/projectroot
VPATH=../libs:../include
INC=-I$(ROOT)/include
all: triangle
triangle: triangle.o shader_utils.o
cc -c $(CFLAGS) $< -o $@ $(INC)
shader_utils.o: shader_utils.h
cc -c $(CFLAGS) $< -o $@ $(INC)
clean:
rm -f *.o triangle
.PHONY: all clean
尝试制作时。它告诉这个
cc -c ../include/shader_utils.h -o shader_utils.o -I/media/programming/experiments/projectroot/include
cc -c triangle.o -o triangle -I/media/programming/experiments/projectroot/include
cc: warning: triangle.o: linker input file unused because linking not done