📄 default.rules
字号:
## Copyright (c) 2000, 2001, 2007 Dmitry Butskoy# <buc@citadel.stu.neva.ru># License: GPL v2 or any later## See COPYING for the status of this software.### Default a target`s Makefile. Useful for any things...# For some changes, copy it to a dir where needed and edit that copy.#ifndef srcdirrul := Make.rulespath := $(word 1, $(wildcard ../$(rul) ../../$(rul)))ifeq ($(path),../$(rul))srcdir = $(dir $(CURDIR))endififeq ($(path),../../$(rul))srcdir = $(dir $(patsubst %/,%,$(dir $(CURDIR))))TARGET = .MODULEendififeq ($(srcdir),)$(error Cannot find srcdir (where $(rul) exists))endifendififndef TARGETTARGET = $(notdir $(CURDIR))endifinclude $(srcdir)/Make.rules## LIBDIRS DEFAULTS#ifeq ($(filter $(TARGET),$(LIBDIRS)),$(TARGET))ifeq ($(shared),yes)all: $(TARGET).so$(TARGET).so: $(OBJS) $(CC) -shared -o $@ -Wl,-soname -Wl,$@ $(OBJS)elseall: $(TARGET).a$(TARGET).a: $(OBJS) rm -f $@ $(AR) -rc $@ $(OBJS) $(RANLIB) $@endifinstall_what = $(wildcard $(TARGET).so $(TARGET).a)install_dir = $(libdir)install_includes = $(wildcard *.h)cross_stamp_file = $(wildcard .cross:*)ifeq ($(cross_stamp_file),)cross_stamp = .cross:elsecross_stamp = $(cross_stamp_file)endifnew_stamp = .cross:$(subst $(empty) ,:,$(CROSS))ifneq ($(cross_stamp),$(new_stamp))$(OBJS): forceforce: rm -f $(cross_stamp) > $(new_stamp) @rm -f *.o *.a *.lo *.soendifendif## MODDIRS DEFAULTS#ifeq ($(filter $(TARGET),$(MODDIRS)),$(TARGET))modules = $(filter-out $(SKIPDIRS), $(patsubst %/,%,$(wildcard */))).PHONY: $(modules)what = alldepend: what = dependclean: what = cleanall depend clean: $(modules)$(modules): mkfile = $(if $(wildcard $@/Makefile),,-f $(srcdir)/default.rules)$(modules): force @$(MAKE) $(mkfile) -C $@ $(what) TARGET=.MODULE MODULE=$@force:install_what = $(wildcard *.so)install_dir = $(libexecdir)endif## MODDIRS` subdirectories (i.e., modules) defaults#ifeq ($(TARGET),.MODULE)ifndef MODULEMODULE = $(notdir $(CURDIR))endififeq ($(shared),yes)all: ../$(MODULE).so../$(MODULE).so: $(OBJS) $(LIBDEPS) $(CC) -shared -o $@ $(OBJS) $(LIBS)elseall: ../$(MODULE).o../$(MODULE).o: $(OBJS) $(LD) -r -o $@ $(OBJS)endifendif## EXEDIRS DEFAULTS (for usual executables)#ifeq ($(filter $(TARGET),$(EXEDIRS)),$(TARGET))ifeq ($(filter $(TARGET),$(MODUSERS)),$(TARGET))MOD_OBJS = $(wildcard $(foreach dir,$(MODDIRS),$(srcdir)/$(dir)/*.o))ifeq ($(shared),yes)override LDFLAGS := -rdynamic $(LDFLAGS)endifinstall_includes= $(wildcard $(foreach dir,$(INCLUDEDIRS),$(srcdir)/$(dir)/*.h))install_includes:= $(filter-out $(srcdir)/include/version.h,$(install_includes))elseMOD_OBJS =endifall: $(TARGET)$(TARGET): $(OBJS) $(MOD_OBJS) $(LIBDEPS) $(CC) $(LDFLAGS) -o $@ $(OBJS) $(MOD_OBJS) $(LIBS)install_what = $(wildcard $(TARGET))install_dir = $(if $(filter $(TARGET),$(SBINUSERS)),$(sbindir),$(bindir))endif## Install stuff#install_manuals = $(wildcard *.[0-9] *.[0-9]?)install:ifneq ($(install_dir),) @mkdir -p $(DESTDIR)$(install_dir)endififneq ($(install_what),) $(INSTALL) $(install_what) $(DESTDIR)$(install_dir)endififneq ($(install_includes),) @mkdir -p $(DESTDIR)$(includedir) $(INSTALL) $(install_includes) $(DESTDIR)$(includedir)endif @trueifneq ($(install_manuals),)define inst_man@mkdir -p $(DESTDIR)$(mandir)/man$(patsubst .%,%,$(suffix $(1))) cp -f $(1) $(DESTDIR)$(mandir)/man$(patsubst .%,%,$(suffix $(1))) endef $(foreach man,$(install_manuals),$(call inst_man,$(man)))endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -