summaryrefslogtreecommitdiffstats
path: root/Makefile.common
blob: 051e92bbae4c4d8b0c33962c27788f616626275d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# -*- Makefile -*-
#
# Common Makefile for building RPMs
# Licensed under the new-BSD license (http://www.opensource.org/licenses/bsd-license.php)
# Copyright (C) 2004-2005 Red Hat, Inc.
# Copyright (C) 2005 Fedora Foundation
#
# $Id: Makefile.common,v 1.106 2008/07/21 19:01:59 ausil Exp $

# Do one thing...find out what SCM we need to work with and whether we are
# a traditional SRPM style file makeup or an exploded source repo.  Once we
# know that, pass off to the appropriate Makefile

# Define the common dir.
# This needs to happen first.
define find-common-dir
for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then echo "$$d"; break ; fi ; done
endef
COMMON_DIR := $(shell $(find-common-dir))

# Get what SCM this repo uses...the plan is to add scm packages as support for
# them is added...right now we only do cvs and git, so that's all we test for
define find-what-scm
for d in CVS git  ; do if [ -d .$$d -o -d $$d ] ; then echo $$d ; fi ; done
endef
SCM := $(shell $(find-what-scm))

# Get our package file layout: either dist (meaning traditional srpm style) or
# repo (meaning exploded source style)
define find-layout
[ -d distropkg ] && echo "repo" || echo "dist"
endef
LAYOUT := $(shell $(find-layout))

include $(COMMON_DIR)/Makefile.$(LAYOUT)-$(SCM)