由买买提看人间百态

topics

全部话题 - 话题: objdir
(共0页)
d***a
发帖数: 13752
1
来自主题: Programming版 - 请教一个makefile 小问题

你用的sample看起来不适合你想用的情况。试试以下面这个sample为模板。
http://www.gnu.org/software/make/manual/make.html#Prerequisite-
OBJDIR := objdir
OBJS := $(addprefix $(OBJDIR)/,foo.o bar.o baz.o)

$(OBJDIR)/%.o : %.c
$(COMPILE.c) $(OUTPUT_OPTION) $<

all: $(OBJS)
这里OBJDIR相当于你文件中的BASE_SRC_DIR,all是$(TARGET),再用你的文件清单替换
OBJS定义中的文件清单。
d******e
发帖数: 143
2
来自主题: Programming版 - makefile question
it's GNU make3.8
if there're 3 source files in 3 sub dir:(current dir is /proj)
/proj/A/a.c
/proj/B/b.c
/proj/C/c.c
/proj/obj
makefile in /proj:
################
DIR1 = ./A
DIR2 = ./B
DIR3 = ./C
OBJDIR = ./obj
VPATH=.:$(DIR1):$(DIR2):$(DIR3):$(OBJDIR)
#default target, link all objs to exe
test: a.o b.o c.o
g++ $^ -o $@
# compile cpp and put objs in OBJDIR
%.o : %.cpp
g++ -c $^ -o $(OBJDIR)/$@
################
problem:
first time run: make test, all 3 object files are created and save
W*****x
发帖数: 684
3
$ cd geoip-api-c-master
$ libtoolize
$ aclocal
$ autoconf
$ automake --add-missing
$./configure
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
... 阅读全帖
(共0页)