updated top-level README and version_decl for V4.4.2 (#1795)
[WRF.git] / external / io_grib_share / build / depend_rules.mk
blob4948a6ca3d8918110aabde1720185325a69c4889
1 #------------------------------------------------------------------------------
2 # Make rules for determining the dependencies between source files.
4 # This file is intended for use in a Makefile via the include directive, e.g.
6 # include $(BUID_DIR)/depend_rules.mk
8 # It may also be include by other rule files in this directory.
10 # These rules rely upon proper setting of OBJS and SRC_EXTENSIONS.
12 # Copyright (C) 2001, WSI Corporation
13 #------------------------------------------------------------------------------
15 # For portability, use the Bourne shell within Makefiles.
16 # There have been problems using the C-shell under Linux.
18 SHELL=/bin/sh
21 # RULES for creating the source code dependencies.
23 # These are typically used to implement the rules depend and clean_depend
24 # in other make rule files.
26 # 'generic_depend' creates the dependencies and appends them to a separate
27 # file in the same directory as the source code, called .depend.
28 # Depend uses some customized logic to determine the name of the source
29 # code file associated with each object file in OBJS. This means that we
30 # can mix source code extensions in the same library (e.g. use C and C++
31 # source interchangeably). See compile_rules.mk for supported file name
32 # extensions for C and C++ development.
34 # 'generic_clean_depend' removes the dependencies file .depend.
36 generic_clean_depend:
37 @rm -f .depend
39 generic_depend:
40 @srcs="" ;\
41 if [ -z "$(OBJS)" ]; then\
42 objs="foobar";\
43 else\
44 objs="$(OBJS)";\
45 fi;\
46 for o in $${objs}; do\
47 if [ $$o = "foobar" ]; then\
48 echo "Error: no objects were specified in OBJS.";\
49 continue;\
50 fi;\
51 b=`echo $$o | sed -e 's/\.o//'` ;\
52 f="" ;\
53 for e in $(SRC_EXTENSIONS) ; do \
54 s="$$b$$e" ;\
55 if [ -r "$$s" ]; then\
56 srcs="$${srcs} $$s" ;\
57 f=1 ;\
58 break ;\
59 fi; \
60 done ;\
61 if [ -z "$$f" ]; then\
62 echo "Could not find source file for object file $$o";\
63 fi ;\
64 done ;\
65 make_opts="";\
66 if [ "$(SYS_CXX_INCLUDES)" ]; then\
67 make_opts="-I+ $(SYS_CXX_INCLUDES)";\
68 fi;\
69 if [ "$(SYS_C_INCLUDES)" ]; then\
70 make_opts="$${make_opts} -I+ $(SYS_C_INCLUDES)";\
71 fi;\
72 if [ "$(C_INCLUDES)" ]; then\
73 make_opts="$${make_opts} -I+ $(C_INCLUDES)";\
74 fi;\
75 if [ "$(CXX_INCLUDES)" ]; then\
76 make_opts="$${make_opts} -I+ $(CXX_INCLUDES)";\
77 fi;\
78 makedepend $${make_opts} -f- $${srcs} > .depend;