mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-19 10:53:58 +00:00
93 lines
1.9 KiB
Plaintext
93 lines
1.9 KiB
Plaintext
# $Id: Simple.Rules,v 1.3 2001/02/22 04:55:41 agmorgan Exp $
|
|
#
|
|
# For simple modules with no significant dependencies, set $(TITLE)
|
|
# and include this file.
|
|
#
|
|
# There are a few ways to customize this set of rules. Namely, define
|
|
#
|
|
# $(MODULE_SIMPLE_EXTRACLEAN)
|
|
# $(MODULE_SIMPLE_CLEAN)
|
|
# $(MODULE_SIMPLE_REMOVE)
|
|
# $(MODULE_SIMPLE_INSTALL)
|
|
# $(MODULE_SIMPLE_EXTRALIBS) - other things to link with the module
|
|
# $(MODULE_SIMPLE_EXTRAFILES) - other files to build (no .c suffix)
|
|
#
|
|
|
|
LIBFILES = $(TITLE) $(MODULE_SIMPLE_EXTRAFILES)
|
|
LIBSRC = $(addsuffix .c,$(LIBFILES))
|
|
LIBOBJ = $(addsuffix .o,$(LIBFILES))
|
|
LIBOBJD = $(addprefix dynamic/,$(LIBOBJ))
|
|
LIBOBJS = $(addprefix static/,$(LIBOBJ))
|
|
|
|
ifdef DYNAMIC
|
|
LIBSHARED = $(TITLE).so
|
|
endif
|
|
|
|
ifdef STATIC
|
|
LIBSTATIC = lib$(TITLE).o
|
|
endif
|
|
|
|
####################### don't edit below #######################
|
|
|
|
all: dirs $(LIBSHARED) $(LIBSTATIC) register
|
|
|
|
dynamic/%.o : %.c
|
|
$(CC) $(CFLAGS) $(DYNAMIC) $(TARGET_ARCH) -c $< -o $@
|
|
|
|
static/%.o : %.c
|
|
$(CC) $(CFLAGS) $(STATIC) $(TARGET_ARCH) -c $< -o $@
|
|
|
|
dirs:
|
|
ifdef DYNAMIC
|
|
$(MKDIR) ./dynamic
|
|
endif
|
|
ifdef STATIC
|
|
$(MKDIR) ./static
|
|
endif
|
|
|
|
register:
|
|
ifdef STATIC
|
|
( cd .. ; ./register_static $(TITLE) $(TITLE)/$(LIBSTATIC) )
|
|
endif
|
|
|
|
ifdef DYNAMIC
|
|
$(LIBOBJD): $(LIBSRC)
|
|
endif
|
|
|
|
ifdef DYNAMIC
|
|
$(LIBSHARED): $(LIBOBJD)
|
|
$(LD_D) -o $@ $(LIBOBJD) $(MODULE_SIMPLE_EXTRALIBS) $(NEED_LINK_LIB_C)
|
|
|
|
endif
|
|
|
|
ifdef STATIC
|
|
$(LIBOBJS): $(LIBSRC)
|
|
endif
|
|
|
|
ifdef STATIC
|
|
$(LIBSTATIC): $(LIBOBJS)
|
|
$(LD) -r -o $@ $(LIBOBJS) $(MODULE_SIMPLE_EXTRALIBS)
|
|
endif
|
|
|
|
install: all
|
|
$(MKDIR) $(FAKEROOT)$(SECUREDIR)
|
|
ifdef DYNAMIC
|
|
$(INSTALL) -m $(SHLIBMODE) $(LIBSHARED) $(FAKEROOT)$(SECUREDIR)
|
|
endif
|
|
$(MODULE_SIMPLE_INSTALL)
|
|
|
|
remove:
|
|
rm -f $(FAKEROOT)$(SECUREDIR)/$(TITLE).so
|
|
$(MODULE_SIMPLE_REMOVE)
|
|
|
|
clean:
|
|
rm -f $(LIBOBJD) $(LIBOBJS) core *~
|
|
$(MODULE_SIMPLE_CLEAN)
|
|
rm -f *.a *.o *.so *.bak
|
|
rm -rf dynamic static
|
|
$(MODULE_SIMPLE_EXTRACLEAN)
|
|
|
|
.c.o:
|
|
$(CC) $(CFLAGS) -c $<
|
|
|