一直不大喜欢写Makefile,认为比较麻烦,而且比较容易出错,对于C/C++代码的编译,我比较依赖于Dev_C++工具,今天晚上出了一个怪事,我在公司用dev_c++编译好的代码,回到家里重新在编译的时候,dev_c++这个工具竟然几次僵住了,无法编译。没有办法,我只好在本机的cygwin环境下,用make来做编译。经过一番折腾终于搞定了下面的makefile,贴出来,请高手指教。
###########################################################################
# Makefile For ocidemo1.c
# Makefile created by Dev-C++ 4.9.9.2
#modify by zhanghua 2006-3-8
CPP = gcc.exe -D__DEBUG__
CC = gcc.exe -D__DEBUG__
WINDRES = windres.exe
RES =
OBJ = cdemo1.o $(RES)
LINKOBJ = cdemo1.o $(RES)
LIBS = -L"d:/soft/Dev-Cpp/lib" -L"D:/OCI/lib/msvc" lib/msvc/oci.lib lib/msvc/ociw32.lib lib/msvc/oramts.lib -g3
INCS = -I"D:/OCI/include" -I"D:/cygwin/usr/include"
CXXINCS = -I"D:/OCI/include" -I"D:/cygwin/usr/include"
BIN = ocidemo1.exe
CXXFLAGS = $(CXXINCS) -ansi -g3
CFLAGS = $(INCS) -ansi -g3
RM = rm -f
.PHONY: all all-before all-after clean clean-custom
all: all-before ocidemo1.exe all-after