@@ -77,16 +77,10 @@ ifneq (,$(findstring NCDF_4,$(FPPFLAGS)))
7777 CDF = 4
7878endif
7979
80-
81- # Include the makefile in the src directory
82- include $(TOP_DIR ) /src/Makefile.inc
83-
84-
85-
8680# The linker is a fortran compiler
8781LINK := $(FC )
8882
89-
83+ # #
9084# Figure out if the fdict library is linked manually.
9185# In this case we do not add dependency on the
9286ifeq (,$(findstring fdict,$(LIBS ) ) )
@@ -111,6 +105,11 @@ install: install-fdict
111105settings.bash : lib-fdict FORCE
112106 -cp fdict/obj/settings.bash .
113107
108+ .PHONY : copy-fdict copy
109+ copy-fdict : prep-fdict
110+ $(MAKE ) -C fdict/obj copy
111+ copy : copy-fdict
112+
114113else
115114 # In this instance the fdict library is supplied externally
116115 # The variable FDICT_PREFIX should be present
@@ -127,22 +126,44 @@ settings.bash:
127126
128127endif
129128
129+ # Create target
130+ .PHONY : lib
131+ lib : settings.bash
132+
133+ # Include the makefile in the src directory
134+ include $(TOP_DIR ) /src/Makefile.inc
135+
136+
137+ # Include the makefile in the test directory
138+ include $(TOP_DIR ) /test/Makefile.inc
139+
140+ # Libraries depend on the objects
141+ ifneq ($(LIBRARIES ) ,)
142+
143+ $(LIBRARIES ) : $(OBJECTS )
144+ $(OBJECTS ) : settings.bash
145+ lib : $(LIBRARIES )
146+
147+ endif
148+
149+
130150
151+ # #
131152# This handy target copies from the SOURCES_DIR all sources
132153# to the current directory
133154# But ONLY if the current directory is not the top of the project
134- .PHONY : copy
155+ .PHONY : copy-ncdf copy
156+ copy-ncdf :
135157ifeq ($(TOP_DIR ) ,.)
136- copy :
137158 @echo ""
138159 @echo "make copy does not work when executed from the top ncdf directory"
139160 @echo "Please create an object directory with an appropriate Makefile"
140161 @echo ""
141162else
142- copy :
143163 cp $(SOURCES_DIR)/src/*.f90 .
144164endif
145165
166+ copy : copy-ncdf
146167
147168# Create source target for creating _only_ the sources.
148169.PHONY : source
@@ -158,17 +179,36 @@ ifneq ($(MPI),0)
158179 SOURCES_DIR := $(SOURCES_DIR ) _parallel
159180endif
160181
161- # Libraries depend on the objects
162- ifneq ($(LIBRARIES ) ,)
163- $(LIBRARIES ) : $(OBJECTS )
164-
165- # Create target
166- .PHONY : lib
167- lib : settings.bash $(LIBRARIES )
168-
169- endif
170-
171-
172- # Include the makefile in the test directory
173- include $(TOP_DIR ) /test/Makefile.inc
174182
183+ # #
184+ # Distribution targets for creating the distribution of flook
185+ # Create distribution for releases
186+ .PHONY : dist-fdict dist-ncdf dist-assemble dist
187+ dist-fdict :
188+ git submodule sync fdict
189+ git submodule init fdict
190+ git submodule update fdict
191+ (cd fdict ; make dist ; mv fdict-* .tar.gz .. )
192+
193+ dist-ncdf :
194+ git archive --format=tar --prefix ncdf-$(PROJECT_VERSION ) / HEAD > ncdf-$(PROJECT_VERSION ) .tar
195+ # Force the creation of the 3 pre-defined source directories
196+ $(MAKE) source CDF=3 MPI=0
197+ $(MAKE) source CDF=4 MPI=0
198+ $(MAKE) source CDF=4 MPI=1
199+ # Clean up
200+ rm *.inc
201+ tar --transform 's,^,ncdf-$(PROJECT_VERSION)/,' -rf ncdf-$(PROJECT_VERSION).tar sources*
202+ -@rm -f ncdf-$(PROJECT_VERSION).tar.gz
203+ gzip ncdf-$(PROJECT_VERSION).tar
204+
205+ dist-assemble : dist-fdict dist-ncdf
206+ -rm -rf .tmp_dist
207+ (mkdir .tmp_dist ; cd .tmp_dist ; \
208+ tar xfz ../ncdf-$(PROJECT_VERSION ) .tar.gz ; cd ncdf-$(PROJECT_VERSION ) ; \
209+ tar xfz ../../fdict-* .tar.gz ; mv fdict-* /* fdict/ ; rm -rf fdict-* ; \
210+ cd .. ; rm ../ncdf-$(PROJECT_VERSION ) .tar.gz ; \
211+ tar cfz ../ncdf-$(PROJECT_VERSION ) .tar.gz ncdf-$(PROJECT_VERSION ) ; \
212+ rm -rf .tmp_dist ../fdict-* .tar.gz)
213+
214+ dist : dist-assemble
0 commit comments