当前位置: 技术问答>linux和unix
AIX 上面makefile问题,(如何向VC那样,.o文件都输出到指定的路径下,如./debug路径下))
来源: 互联网 发布时间:2015-08-29
本文导语: 替换规则应该怎么书写,谁能给我一个简单的例子,工程文件超过了200个,在十几个文件夹下。能有好的替换规则么? 另外, AIX平台上的Makefile文件可以用那些函数处理,我找了一些资料没有找到AIX上面能用的函数...
替换规则应该怎么书写,谁能给我一个简单的例子,工程文件超过了200个,在十几个文件夹下。能有好的替换规则么?
另外,
AIX平台上的Makefile文件可以用那些函数处理,我找了一些资料没有找到AIX上面能用的函数呢
类是$(subst ,,) 这样的函数都不能使用
另外,
AIX平台上的Makefile文件可以用那些函数处理,我找了一些资料没有找到AIX上面能用的函数呢
类是$(subst ,,) 这样的函数都不能使用
|
#*******************************************************************
# FILE NAME : makefile
# Copyright 2000-2001 Openet Corporation. All rights reserved.
#
# Created by : Jack He
# Last Modified Time : 2002.04.08
# Modified by : Jack He
#*******************************************************************
CC = gcc
SYBASE = /home/sybase
ROOTDIR =
LANG =
OBJ = ../obj
EXE = ../bin/smb_dm
SYBASE_OCS = ${SYBASE}/OCS-12_0
PRECOMP = cpre
PRECOMPFLAGS = -l -m -h
LIBFLAGS = -lnsl -lpthread #-lsocket
SYBASELIB = -L${SYBASE_OCS}/lib -lct_r -lcs_r -ltcl_r -lcomn_r -lintl_r
CPPFLAGS = -I../include -I${SYBASE_OCS}/include -D__unix__
OBJS=${OBJ}/cj_main.o ${OBJ}/cj_publ.o ${OBJ}/cj_ftp.o ${OBJ}/sybesql.o
${OBJ}/cj_err.o ${OBJ}/cj_basi.o
build: $(OBJS)
@echo
@echo
$(CC) -o $(EXE) $(OBJS) ${LIBFLAGS} ${SYBASELIB}
@echo
@echo "*** Make my program OK !!! ***"
@echo
${OBJ}/cj_main.o:cj_main.c
$(CC) $(CPPFLAGS) -c cj_main.c
@mv cj_main.o ${OBJ}
@rm -f cj_main.c
cj_main.c:cj_main.cp
${PRECOMP} ${PRECOMPFLAGS} -O cj_main.c cj_main.cp
${OBJ}/cj_err.o:cj_err.c
$(CC) $(CPPFLAGS) -c cj_err.c
@mv cj_err.o ${OBJ}
@rm -f cj_err.c
cj_err.c:cj_err.cp
${PRECOMP} ${PRECOMPFLAGS} -O cj_err.c cj_err.cp
${OBJ}/cj_publ.o:cj_publ.c
$(CC) $(CPPFLAGS) -c cj_publ.c
@mv cj_publ.o ${OBJ}
@rm -f cj_publ.c
cj_publ.c:cj_publ.cp
${PRECOMP} ${PRECOMPFLAGS} -O cj_publ.c cj_publ.cp
${OBJ}/cj_basi.o:cj_basi.c
$(CC) $(CPPFLAGS) -c cj_basi.c
@mv cj_basi.o ${OBJ}
@rm -f cj_basi.c
cj_basi.c:cj_basi.cp
${PRECOMP} ${PRECOMPFLAGS} -O cj_basi.c cj_basi.cp
###########################################
${OBJ}/sybesql.o:${SYBASE_OCS}/include/sybesql.c
${CC} ${CPPFLAGS} -c ${SYBASE_OCS}/include/sybesql.c
@mv sybesql.o ${OBJ}
###########################################
${OBJ}/cj_ftp.o:cj_ftp.c
$(CC) $(CPPFLAGS) -c cj_ftp.c
@mv cj_ftp.o ${OBJ}
###########################################
clean:
@rm -f ${OBJ}/*.o
# FILE NAME : makefile
# Copyright 2000-2001 Openet Corporation. All rights reserved.
#
# Created by : Jack He
# Last Modified Time : 2002.04.08
# Modified by : Jack He
#*******************************************************************
CC = gcc
SYBASE = /home/sybase
ROOTDIR =
LANG =
OBJ = ../obj
EXE = ../bin/smb_dm
SYBASE_OCS = ${SYBASE}/OCS-12_0
PRECOMP = cpre
PRECOMPFLAGS = -l -m -h
LIBFLAGS = -lnsl -lpthread #-lsocket
SYBASELIB = -L${SYBASE_OCS}/lib -lct_r -lcs_r -ltcl_r -lcomn_r -lintl_r
CPPFLAGS = -I../include -I${SYBASE_OCS}/include -D__unix__
OBJS=${OBJ}/cj_main.o ${OBJ}/cj_publ.o ${OBJ}/cj_ftp.o ${OBJ}/sybesql.o
${OBJ}/cj_err.o ${OBJ}/cj_basi.o
build: $(OBJS)
@echo
@echo
$(CC) -o $(EXE) $(OBJS) ${LIBFLAGS} ${SYBASELIB}
@echo
@echo "*** Make my program OK !!! ***"
@echo
${OBJ}/cj_main.o:cj_main.c
$(CC) $(CPPFLAGS) -c cj_main.c
@mv cj_main.o ${OBJ}
@rm -f cj_main.c
cj_main.c:cj_main.cp
${PRECOMP} ${PRECOMPFLAGS} -O cj_main.c cj_main.cp
${OBJ}/cj_err.o:cj_err.c
$(CC) $(CPPFLAGS) -c cj_err.c
@mv cj_err.o ${OBJ}
@rm -f cj_err.c
cj_err.c:cj_err.cp
${PRECOMP} ${PRECOMPFLAGS} -O cj_err.c cj_err.cp
${OBJ}/cj_publ.o:cj_publ.c
$(CC) $(CPPFLAGS) -c cj_publ.c
@mv cj_publ.o ${OBJ}
@rm -f cj_publ.c
cj_publ.c:cj_publ.cp
${PRECOMP} ${PRECOMPFLAGS} -O cj_publ.c cj_publ.cp
${OBJ}/cj_basi.o:cj_basi.c
$(CC) $(CPPFLAGS) -c cj_basi.c
@mv cj_basi.o ${OBJ}
@rm -f cj_basi.c
cj_basi.c:cj_basi.cp
${PRECOMP} ${PRECOMPFLAGS} -O cj_basi.c cj_basi.cp
###########################################
${OBJ}/sybesql.o:${SYBASE_OCS}/include/sybesql.c
${CC} ${CPPFLAGS} -c ${SYBASE_OCS}/include/sybesql.c
@mv sybesql.o ${OBJ}
###########################################
${OBJ}/cj_ftp.o:cj_ftp.c
$(CC) $(CPPFLAGS) -c cj_ftp.c
@mv cj_ftp.o ${OBJ}
###########################################
clean:
@rm -f ${OBJ}/*.o
|
你不用默认的.cpp.o隐式规则,定义一个自己的.cpp.o规则指定好.o的生成路径,应该就可以了吧,没有具体试过,不过可能连接的时候会有问题,需要指定好默认的连接路径。
make的函数你可以info make看下,所有函数的介绍都有的。
make的函数你可以info make看下,所有函数的介绍都有的。
|
such as:
$(OBJPATH)/downfile.o:downfile.c
cc -c downfile.c
mv downfile.o $(OBJPATH)
$(OBJPATH)/downfile.o:downfile.c
cc -c downfile.c
mv downfile.o $(OBJPATH)
|
-o /tmp/xxx 这样可以吗
|
The replace rule you mentioned I have forgotten as I have never used it.
But I think you can use shell command below the cc to implement it.
such as : cp $OBJECT ../obj
But I think you can use shell command below the cc to implement it.
such as : cp $OBJECT ../obj
|
在不同的路径下写Makefile,然后调用。
|
没用过aix,没有这个命令?
man查不到么,那你平时用什么命令查看手册?
man查不到么,那你平时用什么命令查看手册?