Add DESTDIR support. Patch by Alucryd. Closes #1376.

Originally committed to SVN as r6198.
This commit is contained in:
Thomas Goyne 2012-01-08 01:03:45 +00:00
parent 58d6ac1fad
commit c4251bd181
4 changed files with 24 additions and 25 deletions

View file

@ -1,7 +1,6 @@
# *** THERE ARE NO USER-EDITABLE ITEMS HERE. *** # *** THERE ARE NO USER-EDITABLE ITEMS HERE. ***
# #
# TODO: # TODO:
# * DESTDIR= support for make install.
# * Allow variables to be overridden on the CL. # * Allow variables to be overridden on the CL.
.PHONY: all install clean subdirs $(SUBDIRS) .PHONY: all install clean subdirs $(SUBDIRS)
@ -66,30 +65,30 @@ install: $(SUBDIRS) install-share install-program install-lib
install-program: install-program:
ifdef PROGRAM_INSTALL ifdef PROGRAM_INSTALL
@$(BIN_MKDIR) -p $(P_BINDIR) @$(BIN_MKDIR) -p $(DESTDIR)$(P_BINDIR)
@$(BIN_INSTALL) $(PROGRAM) $(P_BINDIR)/$(PROGRAM) @$(BIN_INSTALL) $(PROGRAM) $(DESTDIR)$(P_BINDIR)/$(PROGRAM)
endif endif
install-lib: install-lib:
ifdef LIB_SHARED_INSTALL ifdef LIB_SHARED_INSTALL
$(BIN_MKDIR) -p $(P_LIB) $(BIN_MKDIR) -p $(DESTDIR)$(P_LIB)
$(BIN_INSTALL) $(LIB_SHARED_FULL) $(P_LIB)/$(LIB_SHARED_FULL) $(BIN_INSTALL) $(LIB_SHARED_FULL) $(DESTDIR)$(P_LIB)/$(LIB_SHARED_FULL)
$(BIN_LN) -sf $(LIB_SHARED_FULL) $(P_LIB)/$(LIB_SHARED) $(BIN_LN) -sf $(LIB_SHARED_FULL) $(DESTDIR)$(P_LIB)/$(LIB_SHARED)
endif endif
install-share: install-share:
ifdef DATA_SHARE ifdef DATA_SHARE
@$(BIN_MKDIR) -p $(addprefix $(P_DATA)/, $(dir $(DATA_SHARE))) @$(BIN_MKDIR) -p $(addprefix $(DESTDIR)$(P_DATA)/, $(dir $(DATA_SHARE)))
@for i in $(DATA_SHARE); do \ @for i in $(DATA_SHARE); do \
$(BIN_ECHO) "$(BIN_INSTALL) $$i $(P_DATA)/$$i"; \ $(BIN_ECHO) "$(BIN_INSTALL) $$i $(DESTDIR)$(P_DATA)/$$i"; \
$(BIN_INSTALL) $$i $(P_DATA)/$$i; \ $(BIN_INSTALL) $$i $(DESTDIR)$(P_DATA)/$$i; \
done done
endif endif
ifdef DATA_SHARE_DOC ifdef DATA_SHARE_DOC
@$(BIN_MKDIR) -p $(addprefix $(P_DOC)/, $(dir $(DATA_SHARE_DOC))) @$(BIN_MKDIR) -p $(addprefix $(DESTDIR)$(P_DOC)/, $(dir $(DATA_SHARE_DOC)))
@for i in $(DATA_SHARE_DOC); do \ @for i in $(DATA_SHARE_DOC); do \
$(BIN_ECHO) "$(BIN_INSTALL) $$i $(P_DOC)/$$i"; \ $(BIN_ECHO) "$(BIN_INSTALL) $$i $(DESTDIR)$(P_DOC)/$$i"; \
$(BIN_INSTALL) $$i $(P_DOC)/$$i; \ $(BIN_INSTALL) $$i $(DESTDIR)$(P_DOC)/$$i; \
done done
endif endif

View file

@ -35,10 +35,10 @@ all: ;
install: install-share install: install-share
@$(BIN_MKDIR) -p $(addprefix $(P_DATA)/automation/, $(dir $(DATA_AUTOMATION))) @$(BIN_MKDIR) -p $(addprefix $(DESTDIR)$(P_DATA)/automation/, $(dir $(DATA_AUTOMATION)))
@for i in $(DATA_AUTOMATION); do \ @for i in $(DATA_AUTOMATION); do \
$(BIN_ECHO) "$(BIN_INSTALL) $$i $(P_DATA)/automation/$$i"; \ $(BIN_ECHO) "$(BIN_INSTALL) $$i $(DESTDIR)$(P_DATA)/automation/$$i"; \
$(BIN_INSTALL) $$i $(P_DATA)/automation/$$i; \ $(BIN_INSTALL) $$i $(DESTDIR)$(P_DATA)/automation/$$i; \
done done
DATA_SHARE_DOC = $(DATA_GENERAL_DOC) $(DATA_AUTOMATION_DOC) DATA_SHARE_DOC = $(DATA_GENERAL_DOC) $(DATA_AUTOMATION_DOC)

View file

@ -31,19 +31,19 @@ EXTRA_DIST = \
install: install-desktop install-icons install: install-desktop install-icons
install-desktop: install-desktop:
@$(BIN_MKDIR) -p $(P_DESKTOP) @$(BIN_MKDIR) -p $(DESTDIR)$(P_DESKTOP)
$(BIN_INSTALL) $(DESKTOP_FILE) $(P_DESKTOP)/$(DESKTOP_FILE) $(BIN_INSTALL) $(DESKTOP_FILE) $(DESTDIR)$(P_DESKTOP)/$(DESKTOP_FILE)
install-icons: install-icons:
@$(BIN_MKDIR) -p $(addprefix $(P_ICON)/hicolor/, $(dir $(ICON_HICOLOR))) @$(BIN_MKDIR) -p $(addprefix $(P_ICON)/hicolor/, $(dir $(ICON_HICOLOR)))
@for i in $(ICON_HICOLOR); do \ @for i in $(ICON_HICOLOR); do \
$(BIN_ECHO) "$(BIN_INSTALL) $$i $(P_ICON)/hicolor/$$i"; \ $(BIN_ECHO) "$(BIN_INSTALL) $$i $(DESTDIR)$(P_ICON)/hicolor/$$i"; \
$(BIN_INSTALL) $$i $(P_ICON)/hicolor/$$i; \ $(BIN_INSTALL) $$i $(DESTDIR)$(P_ICON)/hicolor/$$i; \
done done
$(BIN_TOUCH) $(P_ICON)/hicolor $(BIN_TOUCH) $(DESTDIR)$(P_ICON)/hicolor
$(BIN_MKDIR) -p $(P_ICON)/hicolor/scalable/apps $(BIN_MKDIR) -p $(DESTDIR)$(P_ICON)/hicolor/scalable/apps
$(BIN_CP) $(ICON_SCALABLE) $(P_ICON)/hicolor/$(ICON_SCALABLE) $(BIN_CP) $(ICON_SCALABLE) $(DESTDIR)$(P_ICON)/hicolor/$(ICON_SCALABLE)
CLEANFILES = aegisub.desktop CLEANFILES = aegisub.desktop

View file

@ -35,10 +35,10 @@ all: $(MO)
$(BIN_MSGFMT) -o $@ $< $(BIN_MSGFMT) -o $@ $<
install: install:
@$(BIN_MKDIR) -p $(addsuffix /LC_MESSAGES/, $(addprefix $(P_LOCALE)/, $(basename $(PO)))) @$(BIN_MKDIR) -p $(addsuffix /LC_MESSAGES/, $(addprefix $(DESTDIR)$(P_LOCALE)/, $(basename $(PO))))
@for i in $(basename $(PO)); do \ @for i in $(basename $(PO)); do \
echo $(BIN_INSTALL) $$i.mo $(P_LOCALE)/$$i/LC_MESSAGES/$(GETTEXT_PACKAGE).mo; \ echo $(BIN_INSTALL) $$i.mo $(DESTDIR)$(P_LOCALE)/$$i/LC_MESSAGES/$(GETTEXT_PACKAGE).mo; \
$(BIN_INSTALL) $$i.mo $(P_LOCALE)/$$i/LC_MESSAGES/$(GETTEXT_PACKAGE).mo; \ $(BIN_INSTALL) $$i.mo $(DESTDIR)$(P_LOCALE)/$$i/LC_MESSAGES/$(GETTEXT_PACKAGE).mo; \
done done