procps/proc/module.mk
2002-10-10 10:20:13 +00:00

73 lines
1.9 KiB
Makefile

# This file gets included into the main Makefile, in the top directory.
# for lib$(NAME).so and /usr/include/($NAME) and such
NAME := proc
SHARED := 1
SONAME := lib$(NAME).so.$(LIBVERSION)
#ALL += proc/lib$(NAME).a
#INSTALL += $(usr/lib)/lib$(NAME).a # plus $(usr/include)$(NAME) gunk
LIB_CFLAGS := $(CFLAGS)
ifeq ($(SHARED),1)
ALL += proc/$(SONAME)
INSTALL += $(lib)/$(SONAME)
LIB_CFLAGS += -fpic
LIBPROC := proc/$(SONAME)
else
LIBPROC := proc/lib$(NAME).a
endif
LIBSRC := $(wildcard proc/*.c)
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/
#proc/lib$(NAME).a: $(LIBOBJ)
# $(AR) rcs $@ $^
proc/$(SONAME): $(LIBOBJ)
$(CC) -shared -Wl,-soname,$(SONAME) -o $@ $^ -lc
cd proc && $(ln-sf) $(SONAME) lib$(NAME).so
# AUTOMATIC DEPENDENCY GENERATION -- GCC AND GNUMAKE DEPENDENT
proc/.depend: $(LIBSRC) $(LIBHDR)
$(strip $(CC) $(LIB_CFLAGS) -MM -MG $(LIBSRC) > $@)
ifneq ($(MAKECMDGOALS),clean)
-include proc/.depend
endif
$(lib)/$(SONAME) : proc/$(SONAME)
$(install) --mode a=rx --strip $< $@
cd $(lib) && $(ln-sf) $(SONAME) lib$(NAME).so
$(ldconfig)
#$(usr/lib)/lib$(NAME).a : proc/lib$(NAME).a
# $(install) --mode a=r --strip $< $@
# Junk anyway... supposed to go in /usr/include/$(NAME)
#$(HDRFILES) ??? : $(addprefix proc/,$(HDRFILES)) ???
# $(install) --mode a=r $< $@
# CUSTOM c -> o rule so that command-line has minimal whitespace
%.o : %.c
$(strip $(CC) $(LIB_CFLAGS) -c $<)
proc/version.o: proc/version.c proc/version.h
ifdef MINORVERSION
$(strip $(CC) $(LIB_CFLAGS) -DVERSION=\"$(VERSION)\" -DSUBVERSION=\"$(SUBVERSION)\" -DMINORVERSION=\"$(MINORVERSION)\" -c -o $@ $<)
else
$(strip $(CC) $(LIB_CFLAGS) -DVERSION=\"$(VERSION)\" -DSUBVERSION=\"$(SUBVERSION)\" -c -o $@ $<)
endif