⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 makefilesample.htm

📁 收集了一些关于makefile的资料
💻 HTM
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0060)http://www.tatanka.com/prod/tree/nigeria/src/c/Makefile.html -->
<HTML><HEAD><TITLE>Makefile</TITLE>
<META http-equiv=Content-Type content="text/html;&#10;charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1400" name=GENERATOR></HEAD>
<BODY text=#000000 vLink=#551a8b aLink=#ff0000 link=#0000ee bgColor=#ffffff><PRE><TT>
# nigeria-A.0.0.10
# Makefile for src/c/

PROJECT = nigeria

VERSION = A.0.0.10

PRIVATE_HEADERS = enugu.h

GENERATED_HEADER =

GENERATOR_SOURCE =

APPLICATIONS = ngaquery

MAIN_SOURCES = ngaquery.c

PrerequisiteProjects = panama ivoire

#-----------------------------------------------------------------------
# begin common part 1 of Makefile -- version of 2004.07.30
#-----------------------------------------------------------------------
#
#	the following variables may have been defined previously:
#
#	PROJECT -- the project name
#
#	VERSION -- the project version number
#
#	CfgName -- the configuration name; defaults to "default" if not
#		specified (usually, this will be set as an environment
#		variable)
#
#	CfgTarget -- used only for special, predefined target
#		environments
#
#	WORKSHOP -- the directory containing the tree of all projects;
#		defaults to "~/proj"
#
#	PRIVATE_HEADERS -- headers which are used to build the library
#		or application, but which are not made visible to users
#		or to other software
#
#	CONFIG_HEADERS -- headers generated by this software, and which
#		are specific to the configuration
#
#	GENERATED_HEADER -- a header file generated by this application,
#		but which is not specific to any one configuration
#
#	GENERATOR_SOURCE -- the source which generates the
#		GENERATED_HEADER
#
#	APPLICATIONS -- programs, in addition to libraries and
#		intermediate files, to be built
#
#	MAIN_SOURCES -- sources for "main" programs, the compiled object
#		files of which are not to be included in libraries
#
#-----------------------------------------------------------------------
#
#	General organization of Makefile:
#
#	v	initial variable definition (directories, ...)
#	g	flags computations (CFLAGS, LDFLAGS, ...)
#	f	file name computations (lists of files)
#	s	standard targets (all, clean, install, ...)
#	b	Bionic Buffalo common targets
#	t	additional targets (intermediate targets, ...)
#	d	dependency programs (DEPEND.c, ...)
#	p	pattern rules
#
#-----------------------------------------------------------------------
#
#	include user makefile
#

WORKSHOP ?= $(shell cd ../../.. ; pwd)

Workshop = $(wildcard $(WORKSHOP))

-include Makefile_local_v1.mk
-include $(Workshop)/romania/src/make/Makefile_local_v1.mk

# -------- fundamental directories --------
#

VPATH = .:../../src/c

CfgName ?= default

ProjectDir = $(Workshop)/$(PROJECT)

ConfigSuperDir = $(Workshop)/cfg

ConfigDir = $(ConfigSuperDir)/$(CfgName)

BuildSuperDir = $(Workshop)/$(PROJECT)/build

BuildDir = $(BuildSuperDir)/$(CfgName)

BuildDirMarker = $(BuildDir)/DIRECTORY_CREATED

LibrarySuperDir = $(Workshop)/lib

LibraryDir = $(LibrarySuperDir)/$(CfgName)

IncludeDir = $(Workshop)/inc

SourceDir = $(Workshop)/src/c

WorkshopDirs = $(Workshop)/adm $(Workshop)/bin $(Workshop)/cfg \
	$(Workshop)/doc $(Workshop)/inc $(Workshop)/lib \
	$(Workshop)/misc $(Workshop)/tool

AllRequiredDirs = $(WorkshopDirs) $(ConfigDir) $(LibraryDir) $(BuildDir)

# -------- exported variables --------
#

# -------- utilities --------
#
# note: these Makefiles depend on $(COPY) setting the time of the
# destination file to the current time (that is, do not use cp -p)
COPY ?= cp

-include Makefile_local_v2.mk
-include $(Workshop)/romania/src/make/Makefile_local_v2.mk

#-----------------------------------------------------------------------
# end common part 1 of Makefile
#-----------------------------------------------------------------------


ifneq ($(MAKECMDGOALS), clean)
include $(ConfigDir)/panama_makeparms.mk
endif

#-----------------------------------------------------------------------
# begin common part 2 of Makefile -- version of 2004.07.30
#-----------------------------------------------------------------------

-include Makefile_local_g1.mk
-include $(Workshop)/romania/src/make/Makefile_local_g1.mk

#
# -------- search paths --------
#

HeaderSearchFlags ?= -I. \
	-I$(BuildDir)/ \
	-I$(SourceDir)/ \
	-I$(IncludeDir)/ \
	-I$(ConfigDir)/

LibrarySearchFlags ?= -L. -L$(BuildDir)/ -L$(LibraryDir)/$(CfgName)/ -L$(Workshop)/lib/$(CfgName)/

#
# -------- utilities &amp; flags --------
#

CC = $(CfgCC)

CFLAGS = $(filter-out $CfgOmitCflags, $(CfgCflags) $(CfgExtraCflags))

CPPFLAGS = $(filter-out $CfgOmitCppflags, \
	$(HeaderSearchFlags) $(CfgCppflags) $(CfgExtraCppflags))

LDFLAGS = $(filter-out $CfgOmitLdflags, \
	$(LibrarySearchFlags) $(CfgLdflags) $(CfgExtraLdflags))

-include Makefile_local_g2.mk
-include $(Workshop)/romania/src/make/Makefile_local_g2.mk

#-----------------------------------------------------------------------
# end common part 2 of Makefile
#-----------------------------------------------------------------------

#-----------------------------------------------------------------------
# begin common part 3 of Makefile -- version of 2004.09.18
#-----------------------------------------------------------------------

-include Makefile_local_f1.mk
-include $(Workshop)/romania/src/make/Makefile_local_f1.mk

#
# -------- sources, objects, libraries, et caetera --------

LibrarySources = $(filter-out $(GENERATOR_SOURCE) $(MAIN_SOURCES) \
	DEPEND.c, $(wildcard *.c))

PublicHeaders = $(sort $(filter-out $(PRIVATE_HEADERS), \
	$(wildcard *.h)) $(GENERATED_HEADER) )

ConfigHeaders = $(addprefix $(BuildDir)/,$(CONFIG_HEADERS))

InstalledConfigHeaders = $(addprefix $(ConfigDir)/,$(CONFIG_HEADERS))

InstalledHeaders = $(addprefix $(IncludeDir)/,$(PublicHeaders))

OtherProjectHeaders = $(addsuffix .h, \
	$(addprefix $(Workshop)/inc/,$(PrerequisiteProjects)))

PrerequisiteHeaders = $(wildcard *.h) $(ConfigHeaders) $(OtherProjectHeaders)

Sources = $(PRIVATE_SOURCES) $(LibrarySources)

Objects = $(addprefix $(BuildDir)/,$(Sources:.c=.o))

LibraryObjects = $(LibrarySources:.c=.o)

PrefixedLibraryObjects = $(addprefix $(BuildDir)/,$(LibraryObjects))

Library = $(addprefix lib,$(addsuffix .a,$(PROJECT)))

OtherProjectLibraries = $(addprefix $(Workshop)/lib/$(CfgName)/, \
	$(addsuffix .a, \
	$(addprefix lib, $(PrerequisiteProjects))))

PrerequisiteLibraries = $(BuildDir)/$(Library) $(OtherProjectLibraries)

BuiltApplications = $(addprefix $(BuildDir)/,$(APPLICATIONS))

.PHONY : default all clean install install-strip uninstall \
	distclean mostly-clean maintainer-clean \
	TAGS check install-check installdirs \
	global_header_check update_global_libraries \
	update_global_headers \
	binstall binstall-headers binstall-libraries binstall-config \
	buninstall binstalldirs

-include Makefile_local_f2.mk
-include $(Workshop)/romania/src/make/Makefile_local_f2.mk

#-----------------------------------------------------------------------
#
#	standard targets
#
#	(most of these are not yet implemented, but will be -- they are
#	listed here as placeholders)
#

-include Makefile_local_s1.mk
-include $(Workshop)/romania/src/make/Makefile_local_s1.mk

default : all

all : $(BuildDir)/$(Library) $(ConfigHeaders) $(BuiltApplications)

install :

uninstall :

install-strip :

# -------- clean --------
#
#	remove all program-related files which did not come with the
#	distribution
#
clean :
	rm -f tags .*.swp lib* core.* $(GENERATED_HEADER) $(Generator) \
	GLOBAL_HEADERS_CHECKED $(INTERMEDIATE_FILES) *.o *.d
	rm -rf ../../build

#	obsolete rules from above:
#	touch TMP.o TMP.d
#	ls | grep '\.[od]$$' | xargs rm -f

distclean :

mostlyclean :

maintainer-clean :

TAGS :

check :

installcheck :

installdirs :

-include Makefile_local_s2.mk
-include $(Workshop)/romania/src/make/Makefile_local_s2.mk

#-----------------------------------------------------------------------
#
#	Bionic Buffalo variations of some standard targets, to use the
#	variant project directory layout
#

-include Makefile_local_b1.mk
-include $(Workshop)/romania/src/make/Makefile_local_b1.mk

binstall : binstall-headers binstall-libraries binstall-config

binstall-libraries : $(LibraryDir)/$(Library) \
	$(LibrarySuperDir)/Makefile

binstall-headers : $(InstalledHeaders) $(InstalledConfigHeaders) \
	$(IncludeDir)/Makefile

binstall-config : $(InstalledConfigHeaders)

binstalldirs : $(WorkshopDirs) $(ConfigDir) $(LibraryDir)

buninstall :
	-rm -f $(LibraryDir)/$(Library)
	-rm -f $(InstalledHeaders)
	-rm -f $(InstalledConfigHeaders)

# bprerequisites :
#	$(MAKE) -C $(IncludeDir) update_headers

binstall-prerequisites : PrerequisiteHeaderProjects \
	PrerequisiteLibraryProjects

-include Makefile_local_b2.mk
-include $(Workshop)/romania/src/make/Makefile_local_b2.mk

#-----------------------------------------------------------------------
#
#	deprecated pseudonyms
#

update_global_headers : binstall-headers

update_global_libraries : binstall-libraries

#-----------------------------------------------------------------------
#
#	additional targets
#

-include Makefile_local_t1.mk
-include $(Workshop)/romania/src/make/Makefile_local_t1.mk

#
# -------- necessary directories --------
#
$(WorkshopDirs) :
	$(SHELL) -ec '[ -d $@/ ] || mkdir $@/ '

$(LibraryDir) $(ConfigDir) : $(WorkshopDirs)
	$(SHELL) -ec '[ -d $@/ ] || mkdir $@/ '

$(BuildSuperDir) : $(ProjectDir)
	$(SHELL) -ec '[ -d $@/ ] || mkdir $@/ '

$(BuildDir) : $(BuildSuperDir)
	$(SHELL) -ec '[ -d $@/ ] || mkdir $@/ '

$(BuildDirMarker) : $(BuildDir)
	$(SHELL) -ec '[ -f $@ ] || touch $@ '

#
# -------- the project's library --------
#
$(BuildDir)/$(Library) : $(PrefixedLibraryObjects)
	cd $(BuildDir) ; rm -f $@
	cd $(BuildDir) ; $(AR) r $@ $(LibraryObjects)

$(PrefixedLibraryObjects) : $(BuildDir)/DEPEND.o

$(BuildDir)/DEPEND.o : DEPEND.c $(BuildDir)/DEPEND.d $(BuildDirMarker)

#GLOBAL_HEADERS_CHECKED : $(wildcard $(IncludeDir)/*.h) \
#	$(wildcard $(ConfigDir)/*.h) \
#	$(IncludeDir)/Makefile $(LibrarySuperDir)/Makefile
#	$(MAKE) -C $(IncludeDir) update_headers
#	touch GLOBAL_HEADERS_CHECKED

#
# -------- generator &amp; generated header --------
#
Generator = $(basename $(GENERATOR_SOURCE))

$(GENERATED_HEADER) : $(Generator)
	./$(Generator)

$(Generator) : $(GENERATOR_SOURCE)
	gcc -o $(Generator) $(GENERATOR_SOURCE)

#
# -------- installed library --------
#
$(LibraryDir)/$(Library) : $(WorkshopDirs) \
	$(LibraryDir) $(BuildDir)/$(Library)
	$(COPY) $(BuildDir)/$(Library) $@

$(LibrarySuperDir)/Makefile : Makefile_libdir $(LibrarySuperDir)
	$(COPY) $&lt; $@

#
# -------- installed headers --------
#
$(InstalledHeaders) : $(IncludeDir)/% : % $(IncludeDir)
	$(COPY) $&lt; $@

$(IncludeDir)/Makefile : Makefile_includedir $(IncludeDir)
	$(COPY) $&lt; $@

#
# -------- other project headers --------
#
$(OtherProjectHeaders) : $(WorkshopDirs)
	$(MAKE) -C $(Workshop)/$(addsuffix /src/c/,$(basename $(notdir $@))) binstall-headers

#
# -------- other project libraries --------
#
$(OtherProjectLibraries) : $(WorkshopDirs)
	$(MAKE) -C $(Workshop)/$(addsuffix /src/c/, \
	$(subst lib,, $(basename $(notdir $@)))) binstall-libraries

-include Makefile_local_t2.mk
-include $(Workshop)/romania/src/make/Makefile_local_t2.mk

#-----------------------------------------------------------------------
#
#	DEPEND.c etc
#

-include Makefile_local_d1.mk
-include $(Workshop)/romania/src/make/Makefile_local_d1.mk

$(BuildDir)/DEPEND.d : DEPEND.c $(PrerequisiteHeaders) $(BuildDirMarker)
	$(SHELL) -ec 'echo -n $(BuildDir)/ &gt; $@ ; \
		$(CC) -M $(CPPFLAGS) $(CFLAGS) DEPEND.c &gt;&gt; $@; \
		[ -s $@ ] || rm -f $@'

$(BuildDir)/DEPEND.o : $(BuildDir)/DEPEND.d

-include Makefile_local_d2.mk
-include $(Workshop)/romania/src/make/Makefile_local_d2.mk

#-----------------------------------------------------------------------
#
#	pattern rules
#

-include Makefile_local_p1.mk
-include $(Workshop)/romania/src/make/Makefile_local_p1.mk

%.d: %.c
	$(SHELL) -ec '$(CC) -M $(CPPFLAGS) $(CFLAGS) $&lt; \
		| sed '\''s/\($*\)\.o[ :]*/\1.o $@ : /g'\'' &gt; $@; \
		[ -s $@ ] || rm -f $@'

$(BuildDir)/%.o : %.c $(PrerequisiteHeaders)
	$(CC) $(CPPFLAGS) $(CFLAGS) -c $&lt; -o $@

$(BuiltApplications) : $(PrerequisiteLibraries)

$(BuiltApplications) : % : %.o $(PrerequisteLibraries)
	$(CC) $&lt; $(LDFLAGS) -lmorocco -livoire -lpanama -o $@

-include Makefile_local_p2.mk
-include $(Workshop)/romania/src/make/Makefile_local_p2.mk

#-----------------------------------------------------------------------
# end common part 3 of Makefile
#-----------------------------------------------------------------------



$(BUILDDIR)/ngaquery.o : ngaquery.c

$(BUILDDIR)/ngaquery : $(BUILDDIR)/ngaquery.o $(BUILDDIR)/libnigeria.a
	$(CC) $&lt; $(LDFLAGS) \
	-lnigeria -lmorocco -livoire -lpanama \
	-o $@

</TT>
</PRE></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -