2023-02-05 07:34:23 +01:00
|
|
|
#=======================================================================================
|
2024-07-08 09:52:11 +02:00
|
|
|
# Copyright (C) NHR@FAU, University Erlangen-Nuremberg.
|
2023-02-05 07:34:23 +01:00
|
|
|
# All rights reserved.
|
|
|
|
# Use of this source code is governed by a MIT-style
|
|
|
|
# license that can be found in the LICENSE file.
|
|
|
|
#=======================================================================================
|
|
|
|
|
|
|
|
#CONFIGURE BUILD SYSTEM
|
|
|
|
TARGET = exe-$(TAG)
|
|
|
|
BUILD_DIR = ./$(TAG)
|
|
|
|
SRC_DIR = ./src
|
|
|
|
MAKE_DIR = ./
|
|
|
|
Q ?= @
|
|
|
|
|
|
|
|
#DO NOT EDIT BELOW
|
|
|
|
include $(MAKE_DIR)/config.mk
|
|
|
|
include $(MAKE_DIR)/include_$(TAG).mk
|
|
|
|
INCLUDES += -I$(SRC_DIR) -I$(BUILD_DIR)
|
|
|
|
|
|
|
|
VPATH = $(SRC_DIR)
|
2024-07-08 09:52:11 +02:00
|
|
|
SRC = $(filter-out $(wildcard $(SRC_DIR)/*-*.c),$(wildcard $(SRC_DIR)/*.c))
|
2023-02-05 07:34:23 +01:00
|
|
|
ASM = $(patsubst $(SRC_DIR)/%.c, $(BUILD_DIR)/%.s, $(SRC))
|
|
|
|
OBJ = $(patsubst $(SRC_DIR)/%.c, $(BUILD_DIR)/%.o, $(SRC))
|
2024-07-08 09:52:11 +02:00
|
|
|
OBJ += $(BUILD_DIR)/vtkWriter-$(VTK_OUTPUT_FMT).o
|
2023-02-05 07:34:23 +01:00
|
|
|
SOURCES = $(SRC) $(wildcard $(SRC_DIR)/*.h)
|
2024-07-08 09:52:11 +02:00
|
|
|
ifeq ($(VTK_OUTPUT_FMT),mpi)
|
|
|
|
DEFINES += -D_VTK_WRITER_MPI
|
|
|
|
endif
|
|
|
|
|
2023-02-05 07:34:23 +01:00
|
|
|
CPPFLAGS := $(CPPFLAGS) $(DEFINES) $(OPTIONS) $(INCLUDES)
|
|
|
|
|
2024-07-08 09:52:11 +02:00
|
|
|
${TARGET}: sanity-checks $(BUILD_DIR) $(OBJ)
|
2023-02-05 07:34:23 +01:00
|
|
|
$(info ===> LINKING $(TARGET))
|
|
|
|
$(Q)${LINKER} ${LFLAGS} -o $(TARGET) $(OBJ) $(LIBS)
|
|
|
|
|
|
|
|
$(BUILD_DIR)/%.o: %.c $(MAKE_DIR)/include_$(TAG).mk $(MAKE_DIR)/config.mk
|
|
|
|
$(info ===> COMPILE $@)
|
|
|
|
$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
|
|
|
|
$(Q)$(GCC) $(CPPFLAGS) -MT $(@:.d=.o) -MM $< > $(BUILD_DIR)/$*.d
|
|
|
|
|
|
|
|
$(BUILD_DIR)/%.s: %.c
|
|
|
|
$(info ===> GENERATE ASM $@)
|
|
|
|
$(CC) -S $(CPPFLAGS) $(CFLAGS) $< -o $@
|
|
|
|
|
|
|
|
.PHONY: clean distclean tags info asm format
|
|
|
|
|
2024-07-08 09:52:11 +02:00
|
|
|
clean:
|
2023-02-05 07:34:23 +01:00
|
|
|
$(info ===> CLEAN)
|
|
|
|
@rm -rf $(BUILD_DIR)
|
|
|
|
@rm -f tags
|
|
|
|
|
|
|
|
distclean: clean
|
|
|
|
$(info ===> DIST CLEAN)
|
|
|
|
@rm -f $(TARGET)
|
|
|
|
|
|
|
|
info:
|
|
|
|
$(info $(CFLAGS))
|
|
|
|
$(Q)$(CC) $(VERSION)
|
|
|
|
|
|
|
|
asm: $(BUILD_DIR) $(ASM)
|
|
|
|
|
|
|
|
tags:
|
|
|
|
$(info ===> GENERATE TAGS)
|
|
|
|
$(Q)ctags -R
|
|
|
|
|
|
|
|
format:
|
|
|
|
@for src in $(SOURCES) ; do \
|
|
|
|
echo "Formatting $$src" ; \
|
|
|
|
clang-format -i $$src ; \
|
|
|
|
done
|
|
|
|
@echo "Done"
|
|
|
|
|
2024-07-08 09:52:11 +02:00
|
|
|
sanity-checks:
|
|
|
|
ifeq ($(VTK_OUTPUT_FMT),mpi)
|
|
|
|
ifeq ($(ENABLE_MPI),false)
|
|
|
|
$(error VTK_OUTPUT_FMT mpi only supported for ENABLE_MPI true!)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
2023-02-05 07:34:23 +01:00
|
|
|
$(BUILD_DIR):
|
|
|
|
@mkdir $(BUILD_DIR)
|
|
|
|
|
|
|
|
-include $(OBJ:.o=.d)
|