Blame opa/Makefile

Packit 961e70
#
Packit 961e70
#  This file is provided under a dual BSD/GPLv2 license.  When using or
Packit 961e70
#  redistributing this file, you may do so under either license.
Packit 961e70
#
Packit 961e70
#  GPL LICENSE SUMMARY
Packit 961e70
#
Packit 961e70
#  Copyright(c) 2015 Intel Corporation.
Packit 961e70
#
Packit 961e70
#  This program is free software; you can redistribute it and/or modify
Packit 961e70
#  it under the terms of version 2 of the GNU General Public License as
Packit 961e70
#  published by the Free Software Foundation.
Packit 961e70
#
Packit 961e70
#  This program is distributed in the hope that it will be useful, but
Packit 961e70
#  WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 961e70
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 961e70
#  General Public License for more details.
Packit 961e70
#
Packit 961e70
#  Contact Information:
Packit 961e70
#  Intel Corporation, www.intel.com
Packit 961e70
#
Packit 961e70
#  BSD LICENSE
Packit 961e70
#
Packit 961e70
#  Copyright(c) 2015 Intel Corporation.
Packit 961e70
#
Packit 961e70
#  Redistribution and use in source and binary forms, with or without
Packit 961e70
#  modification, are permitted provided that the following conditions
Packit 961e70
#  are met:
Packit 961e70
#
Packit 961e70
#    * Redistributions of source code must retain the above copyright
Packit 961e70
#      notice, this list of conditions and the following disclaimer.
Packit 961e70
#    * Redistributions in binary form must reproduce the above copyright
Packit 961e70
#      notice, this list of conditions and the following disclaimer in
Packit 961e70
#      the documentation and/or other materials provided with the
Packit 961e70
#      distribution.
Packit 961e70
#    * Neither the name of Intel Corporation nor the names of its
Packit 961e70
#      contributors may be used to endorse or promote products derived
Packit 961e70
#      from this software without specific prior written permission.
Packit 961e70
#
Packit 961e70
#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
Packit 961e70
#  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
Packit 961e70
#  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
Packit 961e70
#  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
Packit 961e70
#  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
Packit 961e70
#  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
Packit 961e70
#  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
Packit 961e70
#  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
Packit 961e70
#  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
Packit 961e70
#  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Packit 961e70
#  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Packit 961e70
#
Packit 961e70
#  Copyright (c) 2003-2014 Intel Corporation. All rights reserved.
Packit 961e70
#
Packit 961e70
Packit 961e70
OUTDIR = .
Packit 961e70
Packit 961e70
TARGLIB := libopa
Packit 961e70
MAJOR := $(OPA_LIB_MAJOR)
Packit 961e70
MINOR := $(OPA_LIB_MINOR)
Packit 961e70
Packit 961e70
this_srcdir := $(shell readlink -m .)
Packit 961e70
top_srcdir := $(this_srcdir)/..
Packit 961e70
Packit 961e70
INCLUDES += -I$(top_srcdir) -I$(top_srcdir)/ptl_ips
Packit 961e70
ifeq (${arch},x86_64)
Packit 961e70
	PLATFORM_OBJ=opa_dwordcpy-x86_64-fast.o
Packit 961e70
else
Packit 961e70
	PLATFORM_OBJ=
Packit 961e70
endif
Packit 961e70
Packit 961e70
${TARGLIB}-objs := opa_debug.o opa_time.o \
Packit 961e70
	opa_service.o opa_utils.o \
Packit 961e70
	opa_dwordcpy-$(arch).o opa_sysfs.o opa_syslog.o \
Packit 961e70
	$(PLATFORM_OBJ)
Packit 961e70
Packit 961e70
${TARGLIB}-objs := $(patsubst %.o, $(OUTDIR)/%.o, ${${TARGLIB}-objs})
Packit 961e70
DEPS := $(${TARGLIB}-objs:.o=.d)
Packit 961e70
Packit 961e70
.PHONY: all clean
Packit 961e70
IGNORE_DEP_TARGETS = clean
Packit 961e70
Packit 961e70
all .DEFAULT: ${${TARGLIB}-objs}
Packit 961e70
Packit 961e70
install: all
Packit 961e70
	@echo "Nothing to do for install."
Packit 961e70
Packit 961e70
$(OUTDIR)/%.d:  $(this_srcdir)/%.c
Packit 961e70
	$(CC) $(CFLAGS) $(BASECFLAGS) $(INCLUDES) $< -MM -MF $@ -MQ $(@:.d=.o)
Packit 961e70
Packit 961e70
$(OUTDIR)/%.d:  $(this_srcdir)/%.S
Packit 961e70
	$(CC) $(CFLAGS) $(BASECFLAGS) $(INCLUDES) $< -MM -MF $@ -MQ $(@:.d=.o)
Packit 961e70
Packit 961e70
$(OUTDIR)/%.o: $(this_srcdir)/%.c | ${DEPS}
Packit 961e70
	$(CC) $(CFLAGS) $(BASECFLAGS) $(INCLUDES) -c $< -o $@
Packit 961e70
Packit 961e70
$(OUTDIR)/%.o: $(this_srcdir)/%.S | ${DEPS}
Packit 961e70
	$(CC) $(ASFLAGS) -c $< -o $@
Packit 961e70
Packit 961e70
clean:
Packit 961e70
	@rm -f $(OUTDIR)/_revision.c
Packit 961e70
	@if [ -d $(OUTDIR) ]; then \
Packit 961e70
		cd $(OUTDIR); \
Packit 961e70
		rm -f *.o *.d *.gcda *.gcno ${TARGLIB}.*; \
Packit 961e70
		cd -; \
Packit 961e70
	fi
Packit 961e70
Packit 961e70
Packit 961e70
#ifeq prevents the deps from being included during clean
Packit 961e70
#-include line is required to pull in auto-dependecies during 2nd pass
Packit 961e70
ifeq ($(filter $(IGNORE_DEP_TARGETS), $(MAKECMDGOALS)),)
Packit 961e70
-include ${DEPS}
Packit 961e70
endif