Skip to content

Commit

Permalink
Change makefile for GNU make > 4.3 (develop) (#651)
Browse files Browse the repository at this point in the history
* Update makefile

* Update make.yml

* Update DiagnosticParticleList.h includes
  • Loading branch information
mccoys authored Aug 28, 2023
1 parent c09bc7e commit fa3ae9f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 20 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/make.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ jobs:
export PYTHONEXE=python3
h5pcc -show
export HDF5_ROOT_DIR=/usr/lib/x86_64-linux-gnu/hdf5/openmpi/
#- name: compile Smilei
# run: |
# cd validation
# export HDF5_ROOT_DIR=/usr/lib/x86_64-linux-gnu/hdf5/openmpi/
# python3 validation.py -c -v
- name: compile Smilei
run: |
cd validation
export HDF5_ROOT_DIR=/usr/lib/x86_64-linux-gnu/hdf5/openmpi/
python3 validation.py -c -v
# - name: compile Smilei
# run: |
# export HDF5_ROOT_DIR=/usr/lib/x86_64-linux-gnu/hdf5/openmpi/
# make
make
- name: run quick tests
run: |
export PYTHONEXE=python3
Expand Down
28 changes: 15 additions & 13 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ endif

EXEC = smilei

default: $(EXEC) $(EXEC)_test
default: $(PYHEADERS) $(EXEC) $(EXEC)_test

#-----------------------------------------------------
# Header
Expand Down Expand Up @@ -303,6 +303,12 @@ $(BUILD_DIR)/%.d: %.cpp
$(Q) if [ ! -d "$(@D)" ]; then mkdir -p "$(@D)"; fi;
$(Q) $(SMILEICXX) $(CXXFLAGS) -MF"$@" -MM -MP -MT"$@ $(@:.d=.o)" $<

# Calculate dependencies: special for Params.cpp which needs pyh files
$(BUILD_DIR)/src/Params/Params.d: src/Params/Params.cpp $(PYHEADERS)
@echo "Checking dependencies for $<"
$(Q) if [ ! -d "$(@D)" ]; then mkdir -p "$(@D)"; fi;
$(Q) $(SMILEICXX) $(CXXFLAGS) -MF"$@" -MM -MP -MT"$@ $(@:.d=.o)" $<

ifeq ($(findstring icpc, $(COMPILER_INFO)), icpc)

$(BUILD_DIR)/src/Diagnostic/DiagnosticScalar.o : src/Diagnostic/DiagnosticScalar.cpp
Expand Down Expand Up @@ -341,19 +347,15 @@ $(EXEC)_test : $(OBJS:Smilei.o=Smilei_test.o)
$(Q) $(SMILEICXX) $(OBJS:Smilei.o=Smilei_test.o) -o $(BUILD_DIR)/$@ $(LDFLAGS)
$(Q) cp $(BUILD_DIR)/$@ $@

# Avoid to check dependencies and to create .pyh if not necessary
FILTER_RULES=clean distclean help env debug doc tar happi uninstall_happi
ifeq ($(filter-out $(wildcard print-*),$(MAKECMDGOALS)),)
ifeq ($(filter $(FILTER_RULES),$(MAKECMDGOALS)),)
# Let's try to make the next lines clear: we include $(DEPS) and pygenerator
-include $(DEPS) pygenerator
# and pygenerator will create all the $(PYHEADERS) (which are files)
pygenerator : $(PYHEADERS)
endif
endif

# these are not file-related rules
.PHONY: pygenerator $(FILTER_RULES)
PHONY_RULES=clean distclean help env debug doc tar happi uninstall_happi
.PHONY: $(PHONY_RULES)

# Check dependencies only when necessary
GOALS = $(if $(MAKECMDGOALS), $(MAKECMDGOALS), default)
ifneq ($(filter-out $(PHONY_RULES) print-%, $(GOALS)),)
-include $(DEPS)
endif

#-----------------------------------------------------
# Doc rules
Expand Down
3 changes: 2 additions & 1 deletion src/Diagnostic/DiagnosticParticleList.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef DIAGNOSTICPARTICLELIST_H
#define DIAGNOSTICPARTICLELIST_H

#include "VectorPatch.h"
#include "Diagnostic.h"

class Patch;
Expand Down Expand Up @@ -80,7 +81,7 @@ public :
std::copy( property->begin(), property->begin() + patch_nParticles, buffer.begin() + patch_start[ipatch] );
}
}
};
};

//! Write a dataset
virtual void write_scalar_uint64( H5Write * location, std::string name, uint64_t &, H5Space *file_space, H5Space *mem_space, unsigned int unit_type ) = 0;
Expand Down

0 comments on commit fa3ae9f

Please sign in to comment.