Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # the names of every source file, separated by space;
- # you can use a wildcard, or specify the explicitly
- F90SRC=$(wildcard *.f90)
- # directory in which the object files are located (optional);
- # it must end with a slash
- #OBJPREFIX=obj/
- # note: it's probably a bad idea to put this snippet
- # before the first target rule in the makefile
- # extract the dependencies of the project
- # (the '@' before 'for' silences the output of this command)
- #
- # note: this is kind of a hack, as all it does is to search the
- # sources for a line that looks like "use <module>"
- dependencies.mk: $(F90SRC)
- @for f in $^; do \
- printf "%s:" "$(OBJPREFIX)$${f%.f90}.o"; \
- awk -v p="$(OBJPREFIX)" \
- '$$1 == "use" && NF == 2 { printf " %s%s.o",p,$$2 }' "$$f"; \
- echo; \
- done >$@.tmp; \
- mv $@.tmp $@
- include dependencies.mk
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement