Consume any error produced during GPU detection
[gromacs.git] / share / template / Makefile.pkg
blob05c93595fd8e01790d1cab33fd14a54955d3d955
1 # This is a GROMACS template makefile for your own utility programs using pkg-config.
3 # Copy this file to whatever directory you are using for your own software
5 # Usage:
6 # $ source /path/to/GMXRC
7 # $ make -f Makefile.pkg
9 #change the name of the program here
10 NAME=template
12 #add extra c++ file(s) to compile here
13 EXTRA_SRC=
15 ###############################################################3
16 #below only boring default stuff
17 #only change it if you know what you are doing ;-)
19 #what should be done by default
20 all: $(NAME)
22 #if GMXLDLIB is defined we add it to PKG_CONFIG_PATH
23 ifeq "$(origin GMXLDLIB)" "undefined"
24   $(error "GMXLDLIB not found, please source GMXRC")
25 else
26   export PKG_CONFIG_PATH:=${PKG_CONFIG_PATH}:${GMXLDLIB}/pkgconfig
27 endif
29 #get CPPFLAGS and LDFLAGS from pkg-config
30 CPPFLAGS=`pkg-config --cflags libgromacs`
31 LDFLAGS=`pkg-config --libs libgromacs`
33 #generate a list of object (.o) files
34 OBJS=$(patsubst %.cpp,%.o,$(NAME).cpp $(EXTRA_SRC))
36 #main program depend on all objects, rest is done by implicit rules
37 $(NAME): $(OBJS)
38         $(CXX) $(LDFLAGS) -o $@ $^
40 #clean up rule
41 clean:
42         rm -f $(NAME) $(OBJS)
44 #all, clean are phony rules, e.g. they are always run
45 .PHONY: all clean