mirror of
https://github.com/cp2k/cp2k.git
synced 2026-07-28 14:15:19 -04:00
Makefile: Run discover_programs.py only once
svn-origin-rev: 13731
This commit is contained in:
parent
c643dc4d2c
commit
3d3799ee8a
2 changed files with 11 additions and 16 deletions
|
|
@ -27,6 +27,12 @@ EXEDIR := $(MAINEXEDIR)/$(ARCH)
|
|||
REVISION := $(shell $(CP2KHOME)/tools/get_revision_number $(SRCDIR))
|
||||
|
||||
|
||||
# Discover programs =========================================================
|
||||
ifeq ($(ALL_EXE_FILES),)
|
||||
export ALL_EXE_FILES := $(sort $(shell $(TOOLSRC)/discover_programs.py $(SRCDIR)))
|
||||
endif
|
||||
EXE_NAMES := $(basename $(notdir $(ALL_EXE_FILES)))
|
||||
|
||||
# Once we are down to a single version ======================================
|
||||
# this only happens on stage 3 and 4
|
||||
ifneq ($(ONEVERSION),)
|
||||
|
|
@ -35,14 +41,10 @@ include $(CP2KHOME)/arch/$(ARCH).$(ONEVERSION)
|
|||
LIBDIR := $(MAINLIBDIR)/$(ARCH)/$(ONEVERSION)
|
||||
OBJDIR := $(MAINOBJDIR)/$(ARCH)/$(ONEVERSION)
|
||||
ifeq ($(NVCC),)
|
||||
DISCOVER_FLAGS = "--ignore-cuda-files"
|
||||
EXE_NAMES := $(basename $(notdir $(filter-out %.cu, $(ALL_EXE_FILES))))
|
||||
endif
|
||||
endif
|
||||
|
||||
# Discover programs =========================================================
|
||||
ALL_EXE_FILES := $(sort $(shell $(TOOLSRC)/discover_programs.py $(SRCDIR) $(DISCOVER_FLAGS) ))
|
||||
EXE_NAMES := $(basename $(notdir $(ALL_EXE_FILES)))
|
||||
|
||||
# Declare PHONY targets =====================================================
|
||||
.PHONY : $(VERSION) $(EXE_NAMES) \
|
||||
dirs makedep default_target all \
|
||||
|
|
|
|||
|
|
@ -10,16 +10,13 @@ re_main = re.compile(r"\sint\s+main\s*\(")
|
|||
|
||||
#============================================================================
|
||||
def main():
|
||||
if(len(sys.argv) not in (2,3)):
|
||||
print("Usage: discover_programs.py <src-dir> [--ignore-cuda-files]")
|
||||
if(len(sys.argv) != 2):
|
||||
print("Usage: discover_programs.py <src-dir>")
|
||||
sys.exit(1)
|
||||
|
||||
srcdir = sys.argv[1]
|
||||
|
||||
ignore_cu_files = False
|
||||
if(len(sys.argv) > 2):
|
||||
assert(sys.argv[2] == "--ignore-cuda-files")
|
||||
ignore_cu_files = True
|
||||
sys.stderr.write("Discovering programs ...\n")
|
||||
|
||||
programs = []
|
||||
for root, dirs, files in os.walk(srcdir):
|
||||
|
|
@ -34,11 +31,7 @@ def main():
|
|||
if(is_fortran_program(abs_fn)):
|
||||
programs.append(abs_fn)
|
||||
|
||||
elif(fn[-2:] == ".c"):
|
||||
if(has_main_function(abs_fn)):
|
||||
programs.append(abs_fn)
|
||||
|
||||
elif(fn[-3:] == ".cu" and not ignore_cu_files):
|
||||
elif(fn[-2:]==".c" or fn[-3:]==".cu"):
|
||||
if(has_main_function(abs_fn)):
|
||||
programs.append(abs_fn)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue