|
|
|
|
|
|
|
[Original]
[Print]
[Top]
|
我用了好多年了,好处是添加文件,不需要修改Makefile,会自动扫描新增加的文件,不足的地方是不能同时编译2个可执行文件.不过我所有的工程都在用,实在是很方便, 用的时候请把前面的空格转换成tab, 否则会出错
Makefile :
######################################
#
# Generic makefile
#
# by George Foot
# email: george.foot@merton.ox.ac.uk
# updated by Lenn
# email: liangvy@bigfoot.com
#
# Copyright (c) 1997 George Foot
# All rights reserved.
#
######################################
### Customising
#
# Adjust the following if necessary; EXECUTABLE is the target
# executable's filename, and LIBS is a list of libraries to link in
# (e.g. alleg, stdcx, iostr, etc). You can override these on make's
# command line of course, if you prefer to do it that way.
#
OPENET_LIB := $(HOME)/openetlib
ORACLE_LIB := $(HOME)/orapp-2.0.3
MY_LIB := $(HOME)/lib
ORACLE_VERSION := 9
ORACLE_INCLUDES := -I$(ORACLE_HOME)/rdbms/demo -I$(ORACLE_HOME)/rdbms/public
ORACLE_LIBS := $(ORACLE_HOME)/lib/libclntsh.so
$(ORACLE_HOME)/lib/libwtc$(ORACLE_VERSION).so
VERSION := 1
EXECUTABLE := ubas_gd
LIB_TAG := $(MY_LIB)/libpubd.a $(MY_LIB)/liborapp.a $(ORACLE_LIBS)
LIBS := pthread dl resolv
# Now alter any implicit rules' variables if you like, e.g.:
#
PTHREAD := -pthread -D_PTHREADS
#ORA_FLAGS = -fno-exceptions -fno-rtti -D_REENTRANT=1
ORA_FLAGS = -fno-exceptions -D_REENTRANT=1
CFLAGS := -ggdb -Wall $(ORACLE_INCLUDES) -I$(OPENET_LIB)/include
-I$(OPENET_LIB)/package
-I$(ORACLE_LIB) $(ORA_FLAGS)
# -I/usr/local/include -fno-exceptions -O9 -funroll-loops
CPU_OPTI:= -O9 -funroll-loops -ffast-math -malign-double
-mcpu=pentiumpro -march=pentiumpro
-fomit-frame-pointer -fno-exceptions
CXXFLAGS := $(CFLAGS)
# The next bit checks to see whether rm is in your djgpp bin
# directory; if not it uses del instead, but this can cause (harmless)
# `File not found' error messages. If you are not using DOS at all,
# set the variable to something which will unquestioningly remove
# files.
AS = $(CROSS_COMPILE)as
LD = $(CROSS_COMPILE)ld
CC = $(CROSS_COMPILE)gcc
CPP = $(CC) -E
CCC = $(CROSS_COMPILE)g++
AR = $(CROSS_COMPILE)ar
NM = $(CROSS_COMPILE)nm
STRIP = $(CROSS_COMPILE)strip
RANLIB = $(CROSS_COMPILE)ranlib
MAKE = make
RM := rm -f
# You shouldn't need to change anything below this point.
#
CC := g++
SOURCE := $(wildcard *.c) $(wildcard *.cc)
OBJS := $(patsubst %.c,%.o,$(patsubst %.cc,%.o,$(SOURCE)))
DEPS := $(patsubst %.o,%.d,$(OBJS))
MISSING_DEPS := $(filter-out $(wildcard $(DEPS)),$(DEPS))
MISSING_DEPS_SOURCES := $(wildcard $(patsubst %.d,%.c,$(MISSING_DEPS))
$(patsubst %.d,%.cc,$(MISSING_DEPS)))
CPPFLAGS += -MD
.PHONY : everything deps objs clean veryclean rebuild
everything : $(EXECUTABLE)
deps : $(DEPS)
objs : $(OBJS)
clean :
@$(RM) *.o
@$(RM) *.d
@$(RM) $(EXECUTABLE)
rebuild: veryclean everything
ifneq ($(MISSING_DEPS),)
$(MISSING_DEPS) :
@$(RM) $(patsubst %.d,%.o,$@)
endif
-include $(DEPS)
$(EXECUTABLE) : $(OBJS)
echo const char *version = "`date`"; > version.cc
g++ -c -o version.o version.cc
g++ -ggdb -o $(EXECUTABLE) $(OBJS) $(addprefix -l,$(LIBS)) $(LIB_TAG)
|
|
|
----
-- MSN:liangvy@bigfoot.com
|
|
[Original]
[Print]
[Top]
|
|
|