4
1
mirror of https://github.com/pfloos/quack synced 2024-06-02 11:25:28 +02:00
quack/src/Makefile

54 lines
952 B
Makefile
Raw Normal View History

2020-09-30 00:10:57 +02:00
ALL_DIRS=$(filter-out modules,$(patsubst %/,%,$(wildcard */)))
# Rules for Modules
###################
MOD_DIRS=numgrid
# Rules for Libraries
#####################
LDIR =../lib
LIB_DIRS=$(filter-out $(MAIN_DIRS), $(ALL_DIRS))
MAKEFILES=$(patsubst %,%/Makefile, $(ALL_DIRS))
FORCE:
%/Makefile:
@(echo TARGET=$*.a > $*/Makefile && echo include ../Makefile.include >> $@)
$(LDIR)/%.a: FORCE %/Makefile $(MOD_DIRS)
$(MAKE) -C $* lib
# Rules for executables
#######################
MAIN_DIRS=QuAcK eDFT
BDIR=../bin
ALL_EXEC=$(patsubst %, $(BDIR)/%, $(MAIN_DIRS) )
$(BDIR)/%: $(patsubst %,$(LDIR)/%.a,$(LIB_DIRS)) %/Makefile
$(MAKE) -C $* ../$@
# Rules for both
################
default: $(ALL_EXEC)
.DEFAULT_GOAL := default
.PHONY: default
.PRECIOUS: $(LDIR)/%.a %/Makefile
clean:
rm -f -- $(patsubst %/,$(LDIR)/%.a,$(wildcard */)) ; \
rm -f -- $(ALL_EXEC) ; \
for i in $(MAIN_DIRS) $(LIB_DIRS) ; do rm -f -- $$i/obj/* ; done