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
|
|
|
|
2002-10-10 12:38:13 +05:30
|
|
|
NAME := proc
|
2002-10-09 02:47:06 +05:30
|
|
|
|
2002-10-10 12:38:13 +05:30
|
|
|
LIBSRC += $(wildcard proc/*.c)
|
2002-10-09 02:47:06 +05:30
|
|
|
|
2002-10-10 12:38:13 +05:30
|
|
|
SONAME := lib$(NAME).so.$(LIBVERSION)
|
2002-10-09 02:47:06 +05:30
|
|
|
|
2002-10-10 12:38:13 +05:30
|
|
|
ALL += proc/lib$(NAME).a
|
|
|
|
INSTALL += $(lib)/lib$(NAME).a
|
|
|
|
LIB_CFLAGS := $(CFLAGS)
|
2002-10-09 02:47:06 +05:30
|
|
|
|
2002-10-10 12:38:13 +05:30
|
|
|
ifeq ($(SHARED),1)
|
|
|
|
ALL += proc/$(SONAME)
|
|
|
|
INSTALL += $(lib)/$(SONAME)
|
|
|
|
LIB_CFLAGS += -fpic
|
|
|
|
endif
|
2002-10-09 02:47:06 +05:30
|
|
|
|
2002-10-10 12:38:13 +05:30
|
|
|
# clean away all output files, .depend, and symlinks
|
|
|
|
CLEAN += $(addprefix proc/,$(ALL) .depend)
|
2002-10-09 02:47:06 +05:30
|
|
|
|
2002-10-10 12:38:13 +05:30
|
|
|
------
|
|
|
|
|
|
|
|
# INSTALLATION OPTIONS
|
|
|
|
HDRDIR := /usr/include/$(NAME)# where to put .h files
|
|
|
|
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)))
|
|
|
|
HDR := $(sort $(wildcard *.h) $(filter %.h,$(RCSFILES)))
|
|
|
|
OBJ := $(SRC:.c=.o)
|
2002-10-09 02:47:06 +05:30
|
|
|
|
|
|
|
|
2002-10-10 12:38:13 +05:30
|
|
|
proc/lib$(NAME).a: $(OBJ)
|
2002-10-09 02:47:06 +05:30
|
|
|
$(AR) rcs $@ $^
|
|
|
|
|
2002-10-10 12:38:13 +05:30
|
|
|
proc/$(SONAME): $(OBJ)
|
2002-10-09 02:47:06 +05:30
|
|
|
gcc -shared -Wl,-soname,$(SONAME) -o $@ $^ -lc
|
|
|
|
ln -sf $(SONAME) lib$(NAME).so
|
|
|
|
|
|
|
|
|
|
|
|
# AUTOMATIC DEPENDENCY GENERATION -- GCC AND GNUMAKE DEPENDENT
|
|
|
|
.depend:
|
2002-10-10 12:38:13 +05:30
|
|
|
$(strip $(CC) $(LIB_CFLAGS) -MM -MG $(SRC) > .depend)
|
2002-10-09 02:47:06 +05:30
|
|
|
-include .depend
|
|
|
|
|
|
|
|
|
|
|
|
# INSTALLATION
|
|
|
|
install: all
|
|
|
|
if ! [ -d $(HDRDIR) ] ; then mkdir $(HDRDIR) ; fi
|
2002-10-10 12:38:13 +05:30
|
|
|
$(INSTALL) $(HDROWN) $(HDR) /usr/include/$(NAME)
|
2002-10-09 02:47:06 +05:30
|
|
|
$(INSTALL) $(LIBOWN) lib$(NAME).a $(LIBDIR)
|
|
|
|
ifeq ($(SHARED),1)
|
|
|
|
$(INSTALL) $(LIBOWN) $(SONAME) $(SHLIBDIR)
|
|
|
|
cd $(SHLIBDIR) && ln -sf $(SONAME) lib$(NAME).so
|
|
|
|
ldconfig
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
# CUSTOM c -> o rule so that command-line has minimal whitespace
|
|
|
|
%.o : %.c
|
2002-10-10 12:38:13 +05:30
|
|
|
$(strip $(CC) $(LIB_CFLAGS) -c $<)
|
2002-10-09 02:47:06 +05:30
|
|
|
|
|
|
|
|
|
|
|
version.o: version.c version.h
|
|
|
|
ifdef MINORVERSION
|
2002-10-10 12:38:13 +05:30
|
|
|
$(strip $(CC) $(LIB_CFLAGS) -DVERSION=\"$(VERSION)\" -DSUBVERSION=\"$(SUBVERSION)\" -DMINORVERSION=\"$(MINORVERSION)\" -c version.c)
|
2002-10-09 02:47:06 +05:30
|
|
|
else
|
2002-10-10 12:38:13 +05:30
|
|
|
$(strip $(CC) $(LIB_CFLAGS) -DVERSION=\"$(VERSION)\" -DSUBVERSION=\"$(SUBVERSION)\" -c version.c)
|
2002-10-09 02:47:06 +05:30
|
|
|
endif
|