📄 makefile
字号:
# Auto-adaptive C library Makefile adapted for libproc, Chuck Blake.# Assumptions are basically that all the .c files in the CWD are modules# for the library and that all .h files are the interface to the library.# PROJECT SPECIFIC MACROSNAME = proc# INSTALLATION OPTIONSTOPDIR = /usrHDRDIR = $(TOPDIR)/include/$(NAME)# where to put .h filesLIBDIR = $(TOPDIR)/lib# where to put library filesSHLIBDIR = /lib# where to put shared library filesHDROWN = $(OWNERGROUP) # owner of header filesLIBOWN = $(OWNERGROUP) # owner of library filesINSTALL = install# ----------------------------------------------------------------## The rest is the auto-magic section -- highly GNU make dependent ## You should never need to edit this. ## ----------------------------------------------------------------#VC_SUF = ,vVC_PFX = RCS/RCSFILES = $(patsubst $(VC_PFX)%$(VC_SUF),%,$(wildcard $(VC_PFX)*$(VC_SUF)))# We take the union of RCS files and other files in CWD so that new files do# not need to alter this makefile. 'sort' removes duplicates. This allows the# convenience of compiling and testing new files before the initial check-in.SRC = $(sort $(wildcard *.c) $(filter %.c,$(RCSFILES)))HDR = $(sort $(wildcard *.h) $(filter %.h,$(RCSFILES)))OBJ = $(SRC:.c=.o)SONAME = lib$(NAME).so.$(LIBVERSION)ifeq ($(SHARED),1)CFLAGS += -fpicall: lib$(NAME).a $(SONAME)elseall: lib$(NAME).aendiflib$(NAME).a: $(OBJ) $(AR) rcs $@ $^$(SONAME): $(OBJ) gcc -shared -Wl,-soname,$(SONAME) -o $@ $^ -lc ln -sf $(SONAME) lib$(NAME).so# AUTOMATIC DEPENDENCY GENERATION -- GCC AND GNUMAKE DEPENDENT.depend: $(strip $(CC) $(CFLAGS) -MM -MG $(SRC) > .depend)-include .depend# INSTALLATIONinstall: all if ! [ -d $(HDRDIR) ] ; then mkdir $(HDRDIR) ; fi $(INSTALL) $(HDROWN) $(HDR) $(TOPDIR)/include/$(NAME) $(INSTALL) $(LIBOWN) lib$(NAME).a $(LIBDIR)ifeq ($(SHARED),1) $(INSTALL) $(LIBOWN) $(SONAME) $(SHLIBDIR) ln -sf $(SHLIBDIR)/$(SONAME) $(SHLIBDIR)/lib$(NAME).so ldconfigendif# VARIOUS SHORT CUT TARGETS.PHONY: all install dep clean distclean checkout checkcleandep: .dependclean: $(RM) lib$(NAME).* *.o signames.hdistclean: clean $(RM) .depend signames.hcheckout: $(CO) $(RCSFILES)checkclean: $(RM) $(RCSFILES)# CUSTOM c -> o rule so that command-line has minimal whitespace%.o : %.c $(strip $(CC) $(CFLAGS) -c $<)# PROJECT SPECIFIC DEPENDENCIES/BUILD RULESversion.o: version.c version.hifdef MINORVERSION $(strip $(CC) $(CFLAGS) -DVERSION=\"$(VERSION)\" -DSUBVERSION=\"$(SUBVERSION)\" -DMINORVERSION=\"$(MINORVERSION)\" -c version.c)else $(strip $(CC) $(CFLAGS) -DVERSION=\"$(VERSION)\" -DSUBVERSION=\"$(SUBVERSION)\" -c version.c)endifsignals.o : signames.hsignames.h ../proc/signames.h : /usr/include/signal.h $(CPP) -dM /usr/include/signal.h | \ grep -v SIGSTKSZ | \ tr -s '\t ' ' ' | sort -n +2 | sed \ 's:#define SIG\([A-Z]\+[0-9]*\) \([0-9]\+\) *\(\|/\*.*\)$$:{\\2,"\1" },:p;d' > signames.h
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -