Debian Codegraph @

ext/GOTCHA/Makefile

raw symbols SCIP
1 # =======================================================================================
2 #
3 # Filename: Makefile
4 #
5 # Description: GOTCHA Makefile
6 #
7 # Version: <VERSION>
8 # Released: <DATE>
9 #
10 # Author: Thomas Gruber (tr), [email protected]
11 # Project: likwid
12 #
13 # Copyright (C) 2015 RRZE, University Erlangen-Nuremberg
14 #
15 # This program is free software: you can redistribute it and/or modify it under
16 # the terms of the GNU General Public License as published by the Free Software
17 # Foundation, either version 3 of the License, or (at your option) any later
18 # version.
19 #
20 # This program is distributed in the hope that it will be useful, but WITHOUT ANY
21 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
22 # PARTICULAR PURPOSE. See the GNU General Public License for more details.
23 #
24 # You should have received a copy of the GNU General Public License along with
25 # this program. If not, see <http://www.gnu.org/licenses/>.
26 #
27 # =======================================================================================
28
29 SRC_DIRS = ./src
30 MAKE_DIR = ../../make
31
32 #DO NOT EDIT BELOW
33
34 include ../../config.mk
35 include $(MAKE_DIR)/include_$(COMPILER).mk
36 include $(MAKE_DIR)/config_checks.mk
37 include $(MAKE_DIR)/config_defines.mk
38
39 CFLAGS = -O2 -Wall -fPIC
40 INCLUDES = -I./include
41 LIBS = -lm -Wl,-E -ldl
42
43 Q ?= @
44 ifeq ($(strip $(DEBUG)),true)
45 DEBUG_FLAGS = -g
46 else
47 DEBUG_FLAGS =
48 endif
49 ifeq ($(strip $(SANITIZE)),true)
50 DEBUG_FLAGS += -fsanitize=address -fno-omit-frame-pointer
51 endif
52 ifeq ($(strip $(COMPILER)),MIC)
53 CFLAGS += -mmic
54 LFLAGS += -mmic
55 endif
56
57
58 #CONFIGURE BUILD SYSTEM
59 BUILD_DIR = ./$(COMPILER)
60
61 VPATH = $(SRC_DIRS)
62 FILES = $(notdir $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.c)))
63 OBJ = $(patsubst %.c, $(BUILD_DIR)/%.o, $(FILES))
64
65 CPPFLAGS := $(CPPFLAGS) $(DEFINES) $(INCLUDES)
66 CPPFLAGS := $(filter-out -D_GNU_SOURCE,$(CPPFLAGS))
67
68
69 LIBGOTCHA = $(shell basename $(TARGET_GOTCHA_LIB))
70 INTERPRETER = lua
71
72 all: $(LIBGOTCHA)
73
74 $(STATIC_LIBGOTCHA): $(OBJ)
75 $(info "GOTCHA cannot be build statically in LIKWID")
76 #@echo "===> CREATE STATIC LIB $@"
77 #$(Q)${AR} -cq $(LIBGOTCHA) $(OBJ)
78
79 $(SHARED_LIBGOTCHA): $(OBJ)
80 @echo "===> CREATE SHARED LIB $@"
81 $(Q)$(CC) $(DEBUG_FLAGS) $(LFLAGS) -Wl,-soname,$(LIBGOTCHA).$(VERSION).$(RELEASE),--no-undefined -shared -fPIC -o $(LIBGOTCHA) $(OBJ) $(LIBS)
82
83 #PATTERN RULES
84 $(BUILD_DIR)/%.o: %.c
85 @echo "===> COMPILE $@"
86 @mkdir -p $(BUILD_DIR)
87 $(Q)$(CC) -c $(DEBUG_FLAGS) $(CFLAGS) $(CPPFLAGS) $< -o $@
88 $(Q)$(CC) $(DEBUG_FLAGS) $(CPPFLAGS) -MT $(@:.d=.o) -MM $< > $(BUILD_DIR)/$*.d
89
90 ifeq ($(findstring $(MAKECMDGOALS),clean),)
91 -include $(OBJ:.o=.d)
92 endif
93
94 .PHONY: clean distclean
95
96 clean:
97 @echo "===> CLEAN GOTCHA"
98 @rm -f $(TARGET) $(SHARED_LIBGOTCHA) $(STATIC_LIBGOTCHA) $(LIBGOTCHA).$(VERSION).$(RELEASE) $(LIBGOTCHA).$(VERSION)
99
100 distclean: clean
101 @echo "===> DIST CLEAN GOTCHA"
102 @rm -f $(TARGET) $(SHARED_LIBGOTCHA) $(STATIC_LIBGOTCHA) $(LIBGOTCHA).$(VERSION).$(RELEASE) $(LIBGOTCHA).$(VERSION)
103 @rm -rf $(BUILD_DIR)