10
1
mirror of https://github.com/pfloos/quack synced 2024-12-24 21:33:45 +01:00
QuAcK/src/Makefile

63 lines
1.7 KiB
Makefile
Raw Normal View History

2020-09-30 09:59:18 +02:00
QUACK_ROOT=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))/..))
export QUACK_ROOT
SDIR=$(QUACK_ROOT)/src
2020-10-12 14:25:30 +02:00
ALL_DIRS=$(patsubst %/,%,$(wildcard */))
2020-09-30 00:10:57 +02:00
# Rules for Modules
###################
2020-10-12 14:25:30 +02:00
MOD_DIRS=libnumgrid
2020-09-30 00:10:57 +02:00
# Rules for Libraries
#####################
2020-09-30 09:59:18 +02:00
LDIR =$(QUACK_ROOT)/lib
2020-09-30 00:10:57 +02:00
LIB_DIRS=$(filter-out $(MAIN_DIRS), $(ALL_DIRS))
FORCE:
2020-09-30 09:59:18 +02:00
$(SDIR)/%/Makefile: FORCE
2020-10-02 13:42:21 +02:00
@(echo QUACK_ROOT=$(QUACK_ROOT) > $@)
@(echo TARGET=$*.a >> $@)
@(echo 'include $$(QUACK_ROOT)/src/Makefile.include' >> $@)
2020-09-30 00:10:57 +02:00
2020-09-30 09:59:18 +02:00
$(LDIR)/%.a: FORCE $(SDIR)/%/Makefile $(MOD_DIRS)
$(MAKE) -C $(SDIR)/$* lib
2020-09-30 00:10:57 +02:00
# Rules for executables
#######################
MAIN_DIRS=QuAcK eDFT
2020-09-30 09:59:18 +02:00
BDIR=$(QUACK_ROOT)/bin
2020-09-30 00:10:57 +02:00
ALL_EXEC=$(patsubst %, $(BDIR)/%, $(MAIN_DIRS) )
2020-09-30 09:59:18 +02:00
$(BDIR)/%: $(patsubst %,$(LDIR)/%.a,$(LIB_DIRS)) $(SDIR)/%/Makefile
$(MAKE) -C $* $@
2020-09-30 00:10:57 +02:00
# Rules for both
################
2020-09-30 09:59:18 +02:00
default: $(ALL_EXEC) $(wildcard $(SDIR)/*/Makefile)
debug:
DEBUG=1 $(MAKE) default
2020-09-30 00:10:57 +02:00
.DEFAULT_GOAL := default
2020-09-30 09:59:18 +02:00
.PHONY: default debug
2020-10-05 16:58:19 +02:00
.PRECIOUS: $(wildcard $(LDIR)/*.a) $(wildcard $(SDIR)/*/Makefile)
2020-10-12 14:25:30 +02:00
.PRECIOUS: /Users/loos/Dropbox/quack/lib/CI.a /Users/loos/Dropbox/quack/lib/CC.a /Users/loos/Dropbox/quack/lib/ADC.a /Users/loos/Dropbox/quack/lib/MP.a /Users/loos/Dropbox/quack/lib/libnumgrid.a /Users/loos/Dropbox/quack/lib/utils.a /Users/loos/Dropbox/quack/lib/HF.a /Users/loos/Dropbox/quack/lib/LR.a /Users/loos/Dropbox/quack/lib/AOtoMO.a /Users/loos/Dropbox/quack/lib/BasCor.a /Users/loos/Dropbox/quack/lib/RPA.a /Users/loos/Dropbox/quack/lib/MC.a /Users/loos/Dropbox/quack/lib/MBPT.a
2020-09-30 00:10:57 +02:00
clean:
rm -f -- $(patsubst %/,$(LDIR)/%.a,$(wildcard */)) ; \
rm -f -- $(ALL_EXEC) ; \
for i in $(MAIN_DIRS) $(LIB_DIRS) ; do rm -f -- $$i/obj/* ; done