make considered very harmful
This commit is contained in:
parent
c8b28e1405
commit
5ef0ba1b18
@ -1,62 +1,59 @@
|
|||||||
# This file gets included into the main Makefile, in the top directory.
|
# This file gets included into the main Makefile, in the top directory.
|
||||||
|
|
||||||
|
# for lib$(NAME).so and /usr/include/($NAME) and such
|
||||||
NAME := proc
|
NAME := proc
|
||||||
|
|
||||||
LIBSRC += $(wildcard proc/*.c)
|
SHARED := 1
|
||||||
|
|
||||||
SONAME := lib$(NAME).so.$(LIBVERSION)
|
SONAME := lib$(NAME).so.$(LIBVERSION)
|
||||||
|
|
||||||
ALL += proc/lib$(NAME).a
|
#ALL += proc/lib$(NAME).a
|
||||||
INSTALL += $(lib)/lib$(NAME).a
|
#INSTALL += $(usr/lib)/lib$(NAME).a # plus $(usr/include)$(NAME) gunk
|
||||||
LIB_CFLAGS := $(CFLAGS)
|
LIB_CFLAGS := $(CFLAGS)
|
||||||
|
|
||||||
ifeq ($(SHARED),1)
|
ifeq ($(SHARED),1)
|
||||||
ALL += proc/$(SONAME)
|
ALL += proc/$(SONAME)
|
||||||
INSTALL += $(lib)/$(SONAME)
|
INSTALL += $(lib)/$(SONAME)
|
||||||
LIB_CFLAGS += -fpic
|
LIB_CFLAGS += -fpic
|
||||||
|
LIBPROC := proc/$(SONAME)
|
||||||
|
else
|
||||||
|
LIBPROC := proc/lib$(NAME).a
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# clean away all output files, .depend, and symlinks
|
LIBSRC := $(wildcard proc/*.c)
|
||||||
CLEAN += $(addprefix proc/,$(ALL) .depend)
|
LIBHDR := $(wildcard proc/*.h)
|
||||||
|
LIBOBJ := $(LIBSRC:.c=.o)
|
||||||
|
|
||||||
------
|
# Clean away all output files, .depend, and symlinks.
|
||||||
|
# Use wildcards in case the version has changed.
|
||||||
|
CLEAN += proc/.depend proc/lib*.so* proc/lib*.a $(LIBOBJ)
|
||||||
|
DIRS += proc
|
||||||
|
|
||||||
# INSTALLATION OPTIONS
|
#proc/lib$(NAME).a: $(LIBOBJ)
|
||||||
HDRDIR := /usr/include/$(NAME)# where to put .h files
|
# $(AR) rcs $@ $^
|
||||||
LIBDIR := /usr/lib# where to put library files
|
|
||||||
HDROWN := $(OWNERGROUP) # owner of header files
|
|
||||||
LIBOWN := $(OWNERGROUP) # owner of library files
|
|
||||||
INSTALL := install
|
|
||||||
|
|
||||||
SRC := $(sort $(wildcard *.c) $(filter %.c,$(RCSFILES)))
|
proc/$(SONAME): $(LIBOBJ)
|
||||||
HDR := $(sort $(wildcard *.h) $(filter %.h,$(RCSFILES)))
|
$(CC) -shared -Wl,-soname,$(SONAME) -o $@ $^ -lc
|
||||||
OBJ := $(SRC:.c=.o)
|
cd proc && $(ln-sf) $(SONAME) lib$(NAME).so
|
||||||
|
|
||||||
|
|
||||||
proc/lib$(NAME).a: $(OBJ)
|
|
||||||
$(AR) rcs $@ $^
|
|
||||||
|
|
||||||
proc/$(SONAME): $(OBJ)
|
|
||||||
gcc -shared -Wl,-soname,$(SONAME) -o $@ $^ -lc
|
|
||||||
ln -sf $(SONAME) lib$(NAME).so
|
|
||||||
|
|
||||||
|
|
||||||
# AUTOMATIC DEPENDENCY GENERATION -- GCC AND GNUMAKE DEPENDENT
|
# AUTOMATIC DEPENDENCY GENERATION -- GCC AND GNUMAKE DEPENDENT
|
||||||
.depend:
|
proc/.depend: $(LIBSRC) $(LIBHDR)
|
||||||
$(strip $(CC) $(LIB_CFLAGS) -MM -MG $(SRC) > .depend)
|
$(strip $(CC) $(LIB_CFLAGS) -MM -MG $(LIBSRC) > $@)
|
||||||
-include .depend
|
-include proc/.depend
|
||||||
|
|
||||||
|
|
||||||
# INSTALLATION
|
$(lib)/$(SONAME) : proc/$(SONAME)
|
||||||
install: all
|
$(install) --mode a=rx --strip $< $@
|
||||||
if ! [ -d $(HDRDIR) ] ; then mkdir $(HDRDIR) ; fi
|
cd $(lib) && $(ln-sf) $(SONAME) lib$(NAME).so
|
||||||
$(INSTALL) $(HDROWN) $(HDR) /usr/include/$(NAME)
|
$(ldconfig)
|
||||||
$(INSTALL) $(LIBOWN) lib$(NAME).a $(LIBDIR)
|
|
||||||
ifeq ($(SHARED),1)
|
#$(usr/lib)/lib$(NAME).a : proc/lib$(NAME).a
|
||||||
$(INSTALL) $(LIBOWN) $(SONAME) $(SHLIBDIR)
|
# $(install) --mode a=r --strip $< $@
|
||||||
cd $(SHLIBDIR) && ln -sf $(SONAME) lib$(NAME).so
|
|
||||||
ldconfig
|
# Junk anyway... supposed to go in /usr/include/$(NAME)
|
||||||
endif
|
#$(HDRFILES) ??? : $(addprefix proc/,$(HDRFILES)) ???
|
||||||
|
# $(install) --mode a=r $< $@
|
||||||
|
|
||||||
|
|
||||||
# CUSTOM c -> o rule so that command-line has minimal whitespace
|
# CUSTOM c -> o rule so that command-line has minimal whitespace
|
||||||
@ -64,9 +61,9 @@ endif
|
|||||||
$(strip $(CC) $(LIB_CFLAGS) -c $<)
|
$(strip $(CC) $(LIB_CFLAGS) -c $<)
|
||||||
|
|
||||||
|
|
||||||
version.o: version.c version.h
|
proc/version.o: proc/version.c proc/version.h
|
||||||
ifdef MINORVERSION
|
ifdef MINORVERSION
|
||||||
$(strip $(CC) $(LIB_CFLAGS) -DVERSION=\"$(VERSION)\" -DSUBVERSION=\"$(SUBVERSION)\" -DMINORVERSION=\"$(MINORVERSION)\" -c version.c)
|
$(strip $(CC) $(LIB_CFLAGS) -DVERSION=\"$(VERSION)\" -DSUBVERSION=\"$(SUBVERSION)\" -DMINORVERSION=\"$(MINORVERSION)\" -c proc/version.c)
|
||||||
else
|
else
|
||||||
$(strip $(CC) $(LIB_CFLAGS) -DVERSION=\"$(VERSION)\" -DSUBVERSION=\"$(SUBVERSION)\" -c version.c)
|
$(strip $(CC) $(LIB_CFLAGS) -DVERSION=\"$(VERSION)\" -DSUBVERSION=\"$(SUBVERSION)\" -c proc/version.c)
|
||||||
endif
|
endif
|
||||||
|
43
ps/module.mk
43
ps/module.mk
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
INSTALL += $(bin)ps
|
INSTALL += $(bin)ps
|
||||||
|
|
||||||
# a file to remove
|
# files to remove
|
||||||
CLEAN += ps/ps
|
CLEAN += ps/ps ps/debug
|
||||||
|
|
||||||
# a directory for cleaning
|
# a directory for cleaning
|
||||||
DIRS += ps
|
DIRS += ps
|
||||||
@ -11,33 +11,26 @@ DIRS += ps
|
|||||||
# a file to create
|
# a file to create
|
||||||
ALL += ps/ps
|
ALL += ps/ps
|
||||||
|
|
||||||
ps: escape.o global.o help.o select.o sortformat.o output.o parser.o display.o
|
PSNAMES := $(addprefix ps/,display escape global help output parser select sortformat)
|
||||||
$(CC) -o ps escape.o global.o help.o select.o sortformat.o output.o parser.o display.o -L../proc -lproc
|
PSOBJ := $(addsuffix .o,$(PSNAMES))
|
||||||
|
PSSRC := $(addsuffix .c,$(PSNAMES))
|
||||||
|
|
||||||
|
ps/ps: $(PSOBJ) $(LIBPROC)
|
||||||
|
$(CC) $(LDFLAGS) -o $@ $^
|
||||||
|
|
||||||
# This just adds the stacktrace code
|
# This just adds the stacktrace code
|
||||||
debug: escape.o global.o help.o select.o sortformat.o output.o parser.o display.o stacktrace.o
|
ps/debug: $(PSOBJ) stacktrace.o $(LIBPROC)
|
||||||
$(CC) -o ps escape.o global.o help.o select.o sortformat.o output.o parser.o display.o stacktrace.o -L../proc -lproc -lefence
|
$(CC) -o $@ $^ -lefence
|
||||||
|
|
||||||
sortformat.o: sortformat.c common.h
|
$(PSOBJ): %.o: ps/%.c ps/common.h proc/$(SONAME)
|
||||||
|
# $(CC) -c $(CFLAGS) $< -o $@
|
||||||
|
|
||||||
global.o: global.c common.h
|
ps/stacktrace.o: ps/stacktrace.c
|
||||||
|
|
||||||
escape.o: escape.c
|
|
||||||
|
|
||||||
help.o: help.c
|
|
||||||
|
|
||||||
select.o: select.c common.h
|
|
||||||
|
|
||||||
output.o: output.c common.h
|
|
||||||
|
|
||||||
parser.o: parser.c common.h
|
|
||||||
|
|
||||||
display.o: display.c common.h
|
|
||||||
|
|
||||||
stacktrace.o: stacktrace.c
|
|
||||||
|
|
||||||
|
|
||||||
$(bin)ps: ps
|
$(bin)ps: ps/ps
|
||||||
install $(OWNERGROUP) --mode a=rx --strip ps $(BINDIR)/ps
|
install --mode a=rx --strip $< $@
|
||||||
install $(OWNERGROUP) --mode a=r ps.1 $(MAN1DIR)/ps.1
|
|
||||||
|
$(man1)ps.1 : ps/ps.1
|
||||||
|
install --mode a=r $< $@
|
||||||
-rm -f $(DESTDIR)/var/catman/cat1/ps.1.gz $(DESTDIR)/var/man/cat1/ps.1.gz
|
-rm -f $(DESTDIR)/var/catman/cat1/ps.1.gz $(DESTDIR)/var/man/cat1/ps.1.gz
|
||||||
|
Loading…
x
Reference in New Issue
Block a user