From b95733310900e86679fce5cbc37e2e18d299f9ca Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Sun, 7 Nov 2004 20:33:32 +0000 Subject: [project @ 2004-11-07 20:33:32 by jmb] Use scandeps for dependency checking Fixup include path in riscos/options.h Lose commented out include in riscos/gui.c (It broke scandeps <- we may wish to fix this too ;) svn path=/import/nstheme/; revision=2437 --- makefile | 24 ++++++++++++++---------- riscos/gui.c | 7 +++---- riscos/options.h | 2 +- scandeps | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 66 insertions(+), 15 deletions(-) create mode 100644 scandeps diff --git a/makefile b/makefile index 71bb865..402360c 100644 --- a/makefile +++ b/makefile @@ -49,7 +49,7 @@ riscos: $(RUNIMAGE) $(RUNIMAGE) : $(OBJS_RISCOS) $(CC) -o $@ $(LDFLAGS_RISCOS) $^ -netsurf.zip: $(RUNIMAGE) +nstheme.zip: $(RUNIMAGE) rm nstheme.zip; riscos-zip -9vr, nstheme.zip !NSTheme # pattern rule for c source @@ -57,15 +57,19 @@ $(OBJDIR_RISCOS)/%.o : %.c @echo "==> $<" @$(CC) -o $@ -c $(CFLAGS_RISCOS) $< -# generate dependencies -depend : $(SOURCES_RISCOS) - -mkdir $(OBJDIR_RISCOS) - $(CC) -MM -MG $(CFLAGS_RISCOS) $^ | sed 's|.*\.o:|$(OBJDIR_RISCOS)/&|g' > depend +# Generate dependencies. +# To disable automatic regeneration of dependencies (eg. if perl is not +# available), remove */*.[ch] from the line below. +# Under RISC OS, you may require *Set UnixFS$sfix "", if perl gives +# "No such file or directory" errors. +depend: */*.[ch] + @echo "--> modified files $?" + @echo "--> updating dependencies" + @-mkdir -p $(OBJDIR_RISCOS) + @perl scandeps nstheme $(OBJDIR_RISCOS) -- $^ > depend + +include depend # remove generated files clean : - -rm $(OBJDIR_RISCOS) - -ifneq ($(OS),riscos) -include depend -endif + -rm $(OBJDIR_RISCOS)/* diff --git a/riscos/gui.c b/riscos/gui.c index be5dae3..84adde0 100644 --- a/riscos/gui.c +++ b/riscos/gui.c @@ -35,7 +35,6 @@ #include "nstheme/riscos/gui.h" #include "nstheme/riscos/help.h" #include "nstheme/riscos/options.h" -//#include "nstheme/riscos/theme.h" #include "nstheme/riscos/wimp.h" #include "nstheme/utils/log.h" #include "nstheme/utils/messages.h" @@ -408,7 +407,7 @@ void ro_gui_icon_bar_click(wimp_pointer *pointer) } else if (pointer->buttons == wimp_CLICK_SELECT) { ro_gui_dialog_prepare_main(); ro_gui_open_window_centre(NULL, dialog_main); - ro_gui_set_caret_first(dialog_main); + ro_gui_set_caret_first(dialog_main); } } @@ -509,13 +508,13 @@ void ro_msg_dataload(wimp_message *message) { free(sprite_filename); sprite_filename = NULL; } - } + } } else { success = ro_gui_load_theme(filename); if (success) { ro_gui_dialog_prepare_main(); ro_gui_open_window_centre(NULL, dialog_main); - ro_gui_set_caret_first(dialog_main); + ro_gui_set_caret_first(dialog_main); } } diff --git a/riscos/options.h b/riscos/options.h index b003da1..8aa5b58 100644 --- a/riscos/options.h +++ b/riscos/options.h @@ -12,7 +12,7 @@ #ifndef _NETSURF_RISCOS_OPTIONS_H_ #define _NETSURF_RISCOS_OPTIONS_H_ -#include "netsurf/desktop/options.h" +#include "nstheme/desktop/options.h" extern char *option_language; diff --git a/scandeps b/scandeps new file mode 100644 index 0000000..e60c5b8 --- /dev/null +++ b/scandeps @@ -0,0 +1,48 @@ +#!/usr/bin/perl -W + +%include = (); + +die "Usage: scandeps prefix object_dirs -- sources" if (@ARGV < 4); + +$prefix = shift @ARGV; +$prefix = $prefix; # silence warning + +@objdirs = (); +while (($z = shift @ARGV) ne "--") { + push @objdirs, $z; +} + +# scan all files for relevant #include lines +foreach my $file (@ARGV) { + open FILE, "<$file" or die "Failed to open $file: $!"; + while (my $line = ) { + if ($line =~ m|#include "$prefix/?([^"]+)"|) { + $include{$file}{$1} = 1; + } + } + close FILE; +} + +# output dependencies +foreach my $file (@ARGV) { + next unless $file =~ m|([^/]+)[.]c$|; + %deps = (); + search_deps($file); + foreach my $z (@objdirs) { + print "$z/$1.o "; + } + print ": $file "; + foreach my $z (sort keys %deps) { print "$z " } + print "\n"; +} + + +sub search_deps { + my $file = shift; + return unless exists $include{$file}; + foreach my $z (keys %{$include{$file}}) { + next if exists $deps{$z}; + $deps{$z} = 1; + search_deps($z); + } +} -- cgit v1.2.3