Makefile.inc.in   [plain text]


#
# Include generated dependency files.
#
XAR_SRCS := xar.c
XAR_SRCS := $(patsubst %, @srcroot@src/%, $(XAR_SRCS))
-include $(XAR_SRCS:@srcroot@%.c=@objroot@%.d)

src_all : @objroot@src/xar @objroot@src/ixar

src_install : @objroot@src/ixar
	@INSTALL@ -d $(DESTDIR)$(BINDIR)
	@INSTALL@ -m 0755 $< $(DESTDIR)$(BINDIR)/xar
	@INSTALL@ -d $(DESTDIR)$(MANDIR)/man1
	@INSTALL@ -m 0644 @srcroot@src/xar.1 $(DESTDIR)$(MANDIR)/man1

src_uninstall :
	rm -f $(DESTDIR)/$(BINDIR)/xar
	rm -f $(DESTDIR)/$(MANDIR)/man1/xar.1

src_clean :
	rm -f @objroot@src/xar
	rm -f @objroot@src/ixar
	rm -f $(XAR_SRCS:@srcroot@%.c=@objroot@%.o)
	rm -f $(XAR_SRCS:@srcroot@%.c=@objroot@%.d)

src_distclean :


ifeq (yes, @shared@)
LIBRXAR := $(LIBRXAR_S)
endif
ifeq (yes, @static@)
LIBRXAR := $(LIBXAR_A)
endif

# xar links against librxar, so that it can be run without first installing
# libxar.
@objroot@src/% : @objroot@src/%.o $(LIBRXAR)
	@mkdir -p $(@D)
ifneq ($(words "" @RPATH@), 1)
	$(CC) $(CFLAGS) -o $@ $< @RPATH@@abs_objroot@lib $(LDFLAGS) $(LIBRXAR) @LIBS@
else
	$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) $(LIBRXAR) @LIBS@
endif

ifeq (yes, @static@)
LIBXAR := $(LIBXAR_A)
endif
ifeq (yes, @shared@)
LIBXAR := $(LIBXAR_S)
endif

# ixar is the version of the xar binary that gets installed.
@objroot@src/i% : @objroot@src/%.o $(LIBXAR)
	@mkdir -p $(@D)
ifneq ($(words "" @RPATH@), 1)
	$(CC) $(CFLAGS) -o $@ $< @RPATH@$(LIBDIR) $(LDFLAGS) $(LIBXAR) @LIBS@
else
	$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) $(LIBXAR) @LIBS@
endif

@objroot@src/%.o : @srcroot@src/%.c
	@mkdir -p $(@D)
	$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
	@$(SHELL) -ec "$(CC) -MM $(CPPFLAGS) $< | sed \"s/\($(subst /,\/,$(notdir $(basename $@)))\)\.o\([ :]*\)/$(subst /,\/,$(strip $(dir $@)))\1.o \2/g\" > $(@:%.o=%.d)"