Permalink
Browse files

Update Makefile

1. Preserve the timestamp by replacing cp with install -p
2. Restrict file permissions by install -m
  • Loading branch information...
cicku committed Dec 12, 2013
1 parent 3d829a5 commit 0ee592e8d2bf59517f6f57e82094740df7cf245f
Showing with 24 additions and 22 deletions.
  1. +24 −22 Makefile
View
@@ -9,6 +9,8 @@ include $(JULIAHOME)/Make.inc
# so that PREFIX/share/julia/VERSDIR can be overwritten without touching
# third-party code).
VERSDIR = v`cut -d. -f1-2 < VERSION`
+INSTALL_F = install -pm644
+INSTALL_M = install -pm755
all: default
default: release
@@ -160,45 +162,45 @@ install:
@$(MAKE) $(QUIET_MAKE) debug
@$(MAKE) $(QUIET_MAKE) release
@for subdir in "bin" "libexec" $(JL_LIBDIR) $(JL_PRIVATE_LIBDIR) "share/julia" "share/man/man1" "include/julia" "share/julia/site/"$(VERSDIR) "etc/julia" ; do \
- mkdir -p $(PREFIX)/$$subdir ; \
+ mkdir -p $(DESTDIR)$(PREFIX)/$$subdir ; \
done
- cp -a $(BUILD)/bin/julia* $(PREFIX)/bin/
- -cp -a $(BUILD)/bin/*.dll $(BUILD)/bin/*.bat $(PREFIX)/bin/
- cp -a $(BUILD)/libexec $(PREFIX)
+ $(INSTALL_B) $(BUILD)/bin/julia* $(DESTDIR)$(PREFIX)/bin/
+ -$(INSTALL_F) $(BUILD)/bin/*.dll $(BUILD)/bin/*.bat $(DESTDIR)$(PREFIX)/bin/
+ $(INSTALL_B) $(BUILD)/libexec $(DESTDIR)$(PREFIX)
ifneq ($(OS),WINNT)
- cd $(PREFIX)/bin && ln -sf julia-$(DEFAULT_REPL) julia
+ cd $(DESTDIR)$(PREFIX)/bin && ln -sf julia-$(DEFAULT_REPL) julia
endif
for suffix in $(JL_LIBS) ; do \
- cp -a $(BUILD)/$(JL_LIBDIR)/lib$${suffix}*.$(SHLIB_EXT)* $(PREFIX)/$(JL_PRIVATE_LIBDIR) ; \
+ $(INSTALL_F) $(BUILD)/$(JL_LIBDIR)/lib$${suffix}*.$(SHLIB_EXT)* $(DESTDIR)$(PREFIX)/$(JL_PRIVATE_LIBDIR) ; \
done
for suffix in $(JL_PRIVATE_LIBS) ; do \
- cp -a $(BUILD)/$(JL_LIBDIR)/lib$${suffix}*.$(SHLIB_EXT)* $(PREFIX)/$(JL_PRIVATE_LIBDIR) ; \
+ $(INSTALL_F) $(BUILD)/$(JL_LIBDIR)/lib$${suffix}*.$(SHLIB_EXT)* $(DESTDIR)$(PREFIX)/$(JL_PRIVATE_LIBDIR) ; \
done
ifeq ($(USE_SYSTEM_LIBUV),0)
ifeq ($(OS),WINNT)
- cp -a $(BUILD)/lib/libuv.a $(PREFIX)/$(JL_PRIVATE_LIBDIR)
- cp -a $(BUILD)/include/tree.h $(PREFIX)/include/julia
+ $(INSTALL_F) $(BUILD)/lib/libuv.a $(DESTDIR)$(PREFIX)/$(JL_PRIVATE_LIBDIR)
+ $(INSTALL_F) $(BUILD)/include/tree.h $(DESTDIR)$(PREFIX)/include/julia
else
- cp -a $(BUILD)/$(JL_LIBDIR)/libuv.a $(PREFIX)/$(JL_PRIVATE_LIBDIR)
+ $(INSTALL_F) $(BUILD)/$(JL_LIBDIR)/libuv.a $(DESTDIR)$(PREFIX)/$(JL_PRIVATE_LIBDIR)
endif
- cp -a $(BUILD)/include/uv* $(PREFIX)/include/julia
+ $(INSTALL_F) $(BUILD)/include/uv* $(DESTDIR)$(PREFIX)/include/julia
endif
- cp -a src/julia.h src/support/*.h $(PREFIX)/include/julia
+ $(INSTALL_F) src/julia.h src/support/*.h $(DESTDIR)$(PREFIX)/include/julia
# Copy system image
- cp $(BUILD)/$(JL_PRIVATE_LIBDIR)/sys.ji $(PREFIX)/$(JL_PRIVATE_LIBDIR)
+ $(INSTALL_F) $(BUILD)/$(JL_PRIVATE_LIBDIR)/sys.ji $(DESTDIR)$(PREFIX)/$(JL_PRIVATE_LIBDIR)
# Copy in all .jl sources as well
- cp -R -L $(BUILD)/share/julia $(PREFIX)/share/
+ cp -R -L $(BUILD)/share/julia $(DESTDIR)$(PREFIX)/share/
ifeq ($(OS), WINNT)
- cp $(JULIAHOME)/contrib/windows/*.bat $(PREFIX)
+ cp $(JULIAHOME)/contrib/windows/*.bat $(DESTDIR)$(PREFIX)
endif
# Copy in beautiful new man page!
- cp $(BUILD)/share/man/man1/julia.1 $(PREFIX)/share/man/man1/
+ $(INSTALL_F) $(BUILD)/share/man/man1/julia.1 $(DESTDIR)$(PREFIX)/share/man/man1/
# Copy etc/julia directory to SYSCONFIGDIR if it is set, otherwise to just $(PREFIX)/etc/
ifneq ($(SYSCONFDIR),)
mkdir -p $(SYSCONFDIR)
- cp -R $(BUILD)/etc/julia $(SYSCONFDIR)/
+ cp -R $(BUILD)/etc/julia $(DESTDIR)$(SYSCONFDIR)/
else
- cp -R $(BUILD)/etc/julia $(PREFIX)/etc/
+ cp -R $(BUILD)/etc/julia $(DESTDIR)$(PREFIX)/etc/
endif
@@ -216,23 +218,23 @@ endif
@$(MAKE) install
cp LICENSE.md julia-$(JULIA_COMMIT)
ifeq ($(OS), Darwin)
- -./contrib/mac/fixup-libgfortran.sh $(PREFIX)/$(JL_PRIVATE_LIBDIR)
+ -./contrib/mac/fixup-libgfortran.sh $(DESTDIR)$(PREFIX)/$(JL_PRIVATE_LIBDIR)
endif
# Copy in juliarc.jl files per-platform for binary distributions as well
# Note that we don't install to SYSCONFDIR: we always install to PREFIX/etc.
# If you want to make a distribution with a hardcoded path, you take care of installation
ifeq ($(OS), Darwin)
- -cat ./contrib/mac/juliarc.jl >> $(PREFIX)/etc/julia/juliarc.jl
+ -cat ./contrib/mac/juliarc.jl >> $(DESTDIR)$(PREFIX)/etc/julia/juliarc.jl
else ifeq ($(OS), WINNT)
- -cat ./contrib/windows/juliarc.jl >> $(PREFIX)/etc/julia/juliarc.jl
+ -cat ./contrib/windows/juliarc.jl >> $(DESTDIR)$(PREFIX)/etc/julia/juliarc.jl
endif
ifeq ($(OS), WINNT)
[ ! -d dist-extras ] || ( cd dist-extras && \
cp 7z.exe 7z.dll libexpat-1.dll zlib1.dll ../$(PREFIX)/bin && \
mkdir ../$(PREFIX)/Git && \
7z x PortableGit.7z -o"../$(PREFIX)/Git" )
- cd $(PREFIX)/bin && rm -f llvm* llc.exe lli.exe opt.exe LTO.dll bugpoint.exe macho-dump.exe
+ cd $(DESTDIR)$(PREFIX)/bin && rm -f llvm* llc.exe lli.exe opt.exe LTO.dll bugpoint.exe macho-dump.exe
./dist-extras/7z a -mx9 -sfx7z.sfx julia-$(JULIA_COMMIT)-$(OS)-$(ARCH).exe julia-$(JULIA_COMMIT)
else
tar zcvf julia-$(JULIA_COMMIT)-$(OS)-$(ARCH).tar.gz julia-$(JULIA_COMMIT)

0 comments on commit 0ee592e

Please sign in to comment.