2002-10-10 12:38:13 +05:30
|
|
|
# This file gets included into the main Makefile, in the top directory.
|
2002-10-09 02:47:06 +05:30
|
|
|
|
2004-07-20 08:42:41 +05:30
|
|
|
# Ideally, we want something like this:
|
|
|
|
#
|
|
|
|
# /lib/libproc.so.w ELF soname ('w' is a digit, starting from 1)
|
|
|
|
# /lib/procps-x.y.z.so file itself (x.y.z is the procps version)
|
|
|
|
# /lib/libproc.so for linking, UNSUPPORTED
|
|
|
|
# /usr/lib/libproc.a for linking, UNSUPPORTED
|
|
|
|
# proc/libproc.so.w as above, if testing with LD_LIBRARY_PATH
|
|
|
|
# proc/whatever if testing with LD_PRELOAD
|
|
|
|
# proc/libproc.a for static build
|
|
|
|
#
|
|
|
|
# Without a stable ABI, there's no point in having any of that.
|
|
|
|
# Without a stable API, there's no point in having the *.a file.
|
|
|
|
#
|
|
|
|
# A new ELF soname is required for every big ABI change. To conserve
|
|
|
|
# numbers for future use, the ELF soname can be set equal to the
|
|
|
|
# file name until some future date when a stable ABI is declared.
|
|
|
|
|
|
|
|
SHARED := 1
|
2002-10-09 02:47:06 +05:30
|
|
|
|
2004-07-21 05:01:12 +05:30
|
|
|
# for lib$(NAME).so and /usr/include/($NAME) and such
|
|
|
|
NAME := proc
|
2002-10-09 02:47:06 +05:30
|
|
|
|
2004-07-20 08:42:41 +05:30
|
|
|
LIBVERSION := $(VERSION).$(SUBVERSION).$(MINORVERSION)
|
2004-07-21 05:01:12 +05:30
|
|
|
ABIVERSION := 0
|
2002-10-13 00:28:39 +05:30
|
|
|
|
2004-07-20 08:42:41 +05:30
|
|
|
SOFILE := lib$(NAME)-$(LIBVERSION).so
|
|
|
|
ifneq ($(ABIVERSION),0)
|
|
|
|
SOLINK := lib$(NAME).so
|
|
|
|
SONAME := lib$(NAME).so.$(ABIVERSION)
|
|
|
|
else
|
|
|
|
SONAME := $(SOFILE)
|
|
|
|
SOLINK := $(SOFILE)
|
|
|
|
endif
|
|
|
|
|
|
|
|
ANAME := lib$(NAME).a
|
|
|
|
|
|
|
|
############
|
2002-10-09 02:47:06 +05:30
|
|
|
|
2003-02-17 06:27:15 +05:30
|
|
|
FPIC := -fpic
|
|
|
|
|
2002-10-10 12:38:13 +05:30
|
|
|
ifeq ($(SHARED),1)
|
|
|
|
ALL += proc/$(SONAME)
|
2004-07-20 08:42:41 +05:30
|
|
|
INSTALL += ldconfig
|
2003-02-17 06:27:15 +05:30
|
|
|
LIBFLAGS := -DSHARED=1 $(FPIC)
|
2004-08-27 19:53:36 +05:30
|
|
|
# This is in gcc 3.5, but exported functions must be marked.
|
|
|
|
#LIBFLAGS += $(call check_gcc,-fvisibility=hidden,)
|
2002-10-10 14:41:50 +05:30
|
|
|
LIBPROC := proc/$(SONAME)
|
|
|
|
else
|
2004-07-20 08:42:41 +05:30
|
|
|
ALL += proc/$(ANAME)
|
|
|
|
#INSTALL += $(usr/lib)$(ANAME)
|
2003-02-17 06:27:15 +05:30
|
|
|
LIBFLAGS := -DSHARED=0
|
2004-07-20 08:42:41 +05:30
|
|
|
LIBPROC := proc/$(ANAME)
|
2002-10-10 12:38:13 +05:30
|
|
|
endif
|
2002-10-09 02:47:06 +05:30
|
|
|
|
2004-07-20 08:42:41 +05:30
|
|
|
LIBSRC := $(wildcard proc/*.c)
|
|
|
|
LIBHDR := $(wildcard proc/*.h)
|
|
|
|
LIBOBJ := $(LIBSRC:.c=.o)
|
|
|
|
|
2002-11-08 10:49:55 +05:30
|
|
|
# Separate rule for this directory, to use -fpic or -fPIC
|
2002-11-09 07:30:52 +05:30
|
|
|
$(filter-out proc/version.o,$(LIBOBJ)): proc/%.o: proc/%.c
|
2003-09-01 05:48:58 +05:30
|
|
|
$(CC) -c $(ALL_CPPFLAGS) $(ALL_CFLAGS) $(LIBFLAGS) $< -o $@
|
2002-10-11 04:10:35 +05:30
|
|
|
|
2003-01-25 13:11:45 +05:30
|
|
|
LIB_X := COPYING module.mk library.map
|
2002-10-11 04:10:35 +05:30
|
|
|
TARFILES += $(LIBSRC) $(LIBHDR) $(addprefix proc/,$(LIB_X))
|
|
|
|
|
|
|
|
|
2002-10-10 14:41:50 +05:30
|
|
|
# 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)
|
2002-10-10 15:50:13 +05:30
|
|
|
DIRS += proc/
|
2002-10-10 12:38:13 +05:30
|
|
|
|
2004-07-20 08:42:41 +05:30
|
|
|
proc/$(ANAME): $(LIBOBJ)
|
2002-10-24 13:19:16 +05:30
|
|
|
$(AR) rcs $@ $^
|
2002-10-09 02:47:06 +05:30
|
|
|
|
2004-07-21 05:01:12 +05:30
|
|
|
#proc/$(SONAME): proc/library.map
|
2002-10-10 14:41:50 +05:30
|
|
|
proc/$(SONAME): $(LIBOBJ)
|
2004-09-23 19:11:33 +05:30
|
|
|
$(CC) $(ALL_CFLAGS) $(ALL_LDFLAGS) -shared -Wl,-soname,$(SONAME) -Wl,--version-script=proc/library.map -o $@ $^ -lc
|
2002-10-09 02:47:06 +05:30
|
|
|
|
|
|
|
|
2002-10-10 14:41:50 +05:30
|
|
|
# AUTOMATIC DEPENDENCY GENERATION -- GCC AND GNUMAKE DEPENDENT
|
|
|
|
proc/.depend: $(LIBSRC) $(LIBHDR)
|
2003-09-01 05:48:58 +05:30
|
|
|
$(strip $(CC) $(ALL_CPPFLAGS) $(LIB_CFLAGS) -MM -MG $(LIBSRC) > $@)
|
2002-10-10 15:50:13 +05:30
|
|
|
|
|
|
|
ifneq ($(MAKECMDGOALS),clean)
|
2002-10-11 04:10:35 +05:30
|
|
|
ifneq ($(MAKECMDGOALS),tar)
|
2004-01-30 03:58:13 +05:30
|
|
|
ifneq ($(MAKECMDGOALS),extratar)
|
2004-09-23 19:11:33 +05:30
|
|
|
ifneq ($(MAKECMDGOALS),beta)
|
2002-10-10 14:41:50 +05:30
|
|
|
-include proc/.depend
|
2002-10-10 15:50:13 +05:30
|
|
|
endif
|
2002-10-11 04:10:35 +05:30
|
|
|
endif
|
2004-01-30 03:58:13 +05:30
|
|
|
endif
|
2004-09-23 19:11:33 +05:30
|
|
|
endif
|
2002-10-09 02:47:06 +05:30
|
|
|
|
2004-07-20 08:42:41 +05:30
|
|
|
#################### install rules ###########################
|
2002-10-09 02:47:06 +05:30
|
|
|
|
2004-07-20 08:42:41 +05:30
|
|
|
$(lib)$(SOFILE) : proc/$(SONAME)
|
2004-07-15 06:47:15 +05:30
|
|
|
$(install) --mode a=rx $< $@
|
2004-07-20 08:42:41 +05:30
|
|
|
|
|
|
|
ifneq ($(SOLINK),$(SOFILE))
|
|
|
|
.PHONY: $(lib)$(SOLINK)
|
|
|
|
$(lib)$(SOLINK) : $(lib)$(SOFILE)
|
|
|
|
cd $(lib) && $(ln_sf) $(SOFILE) $(SOLINK)
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(SONAME),$(SOFILE))
|
|
|
|
.PHONY: $(lib)$(SONAME)
|
|
|
|
$(lib)$(SONAME) : $(lib)$(SOFILE)
|
|
|
|
cd $(lib) && $(ln_sf) $(SOFILE) $(SONAME)
|
|
|
|
endif
|
|
|
|
|
|
|
|
.PHONY: ldconfig
|
|
|
|
ldconfig : $(lib)$(SONAME) $(lib)$(SOLINK)
|
2002-10-10 14:41:50 +05:30
|
|
|
$(ldconfig)
|
2002-10-09 02:47:06 +05:30
|
|
|
|
2004-07-20 08:42:41 +05:30
|
|
|
$(usr/lib)$(ANAME) : proc/$(ANAME)
|
|
|
|
$(install) --mode a=r $< $@
|
2002-10-09 02:47:06 +05:30
|
|
|
|
2002-10-10 14:41:50 +05:30
|
|
|
# Junk anyway... supposed to go in /usr/include/$(NAME)
|
2004-07-20 08:42:41 +05:30
|
|
|
#INSTALL += $(addprefix $(include),$(HDRFILES))
|
|
|
|
#
|
|
|
|
#$(addprefix $(include),$(HDRFILES)): $(include)% : proc/%
|
|
|
|
#$(include)% : proc/%
|
2002-10-10 14:41:50 +05:30
|
|
|
# $(install) --mode a=r $< $@
|
2002-10-09 02:47:06 +05:30
|
|
|
|
2004-07-20 08:42:41 +05:30
|
|
|
##################################################################
|
2002-10-09 02:47:06 +05:30
|
|
|
|
2002-10-10 14:41:50 +05:30
|
|
|
proc/version.o: proc/version.c proc/version.h
|
2003-09-01 05:48:58 +05:30
|
|
|
$(CC) $(ALL_CPPFLAGS) $(ALL_CFLAGS) $(LIBFLAGS) -DVERSION=\"$(VERSION)\" -DSUBVERSION=\"$(SUBVERSION)\" -DMINORVERSION=\"$(MINORVERSION)\" -c -o $@ $<
|