Skip to content

Commit

Permalink
Fix issue where VSCode makefile extension can delete files
Browse files Browse the repository at this point in the history
The problem is that VSCode's make extension, in order to determine
some information about the project, runs
```
make --dry-run --always-make
```
which despite its name will actually try to remake the configure/*
files. Running `installEpics.pl` on these will delete them first,
then try copy them, resulting in an error.
  • Loading branch information
simon-ess committed Feb 19, 2024
1 parent 07cbf00 commit cec29ec
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions configure/RULES_BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -532,11 +532,11 @@ endif # LOADABLE_SHRLIB_SUFFIX
ifneq ($(INSTALL_CONFIGS),)
$(INSTALL_CONFIG)/%: %
$(ECHO) "Installing config file $@"
@$(INSTALL) -d -m $(INSTALL_PERMISSIONS) $< $(@D)
@$(INSTALL) -d -m $(INSTALL_PERMISSIONS) $(abspath $<) $(abspath $(@D))

$(INSTALL_CONFIG)/%: ../%
$(ECHO) "Installing config file $@"
@$(INSTALL) -d -m $(INSTALL_PERMISSIONS) $< $(@D)
@$(INSTALL) -d -m $(INSTALL_PERMISSIONS) $(abspath $<) $(abspath $(@D))
endif

$(INSTALL_INCLUDE)/%: $(COMMON_DIR)/%
Expand Down
3 changes: 3 additions & 0 deletions src/tools/installEpics.pl
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@
my $temp = "$install_dir/TEMP.$name.$$";
my $target = "$install_dir/$name";

# Don't try to install the file if it already exists
next if $source eq $target;

if (-f $target) {
next if -M $target < -M $source and -C $target < -C $source;
# Remove old target, making sure it is deletable first
Expand Down

0 comments on commit cec29ec

Please sign in to comment.