]> git.saurik.com Git - apple/mdnsresponder.git/blame - Clients/Makefile
mDNSResponder-1310.80.1.tar.gz
[apple/mdnsresponder.git] / Clients / Makefile
CommitLineData
67c8f8a1
A
1# -*- tab-width: 4 -*-
2#
95d7a4a3 3# Copyright (c) 2002-2004, 2015 Apple Computer, Inc. All rights reserved.
8e92c31c 4#
67c8f8a1
A
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8e92c31c 8#
67c8f8a1 9# http://www.apache.org/licenses/LICENSE-2.0
8e92c31c 10#
67c8f8a1
A
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
8e92c31c 15# limitations under the License.
8e92c31c 16#
8e92c31c
A
17# Notes:
18# $@ means "The file name of the target of the rule"
19# $< means "The name of the first prerequisite"
20# $+ means "The names of all the prerequisites, with spaces between them, exactly as given"
21# For more magic automatic variables, see
22# <http://www.gnu.org/software/make/manual/html_chapter/make_10.html#SEC111>
95d7a4a3
A
23#
24# This makefile uses $(CC) for compilation and linking, which is
25# an automatic implicit gcc variable that defaults to "cc"
26# <https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html>
8e92c31c
A
27
28#############################################################################
29
67c8f8a1
A
30# On OS X the dns_sd library functions are included in libSystem, which is implicitly linked with every executable
31# If /usr/lib/libSystem.dylib exists, then we're on OS X, so we don't need also to link the "dns_sd" shared library
f0cc3e7b
A
32ifeq "$(DEBUG)" "1"
33DEBUGFLAGS = -g
34BUILDDIR = build/debug
35else
36DEBUGFLAGS = -Os
37BUILDDIR = build/prod
38endif
39
67c8f8a1
A
40ifneq "$(wildcard /usr/lib/libSystem.dylib)" ""
41TARGETS = build/dns-sd build/dns-sd64
c9d2d929 42LIBS =
67c8f8a1
A
43else
44TARGETS = build/dns-sd
f0cc3e7b 45LIBS = -L../mDNSPosix/$(BUILDDIR)/ -ldns_sd
8e92c31c
A
46endif
47
67c8f8a1 48all: $(TARGETS)
8e92c31c
A
49
50clean:
51 rm -rf build
52
53build:
54 mkdir build
55
32bb7e43 56build/dns-sd: build dns-sd.c ClientCommon.c
f0cc3e7b 57 $(CC) $(SUPMAKE_CFLAGS) $(filter %.c %.o, $+) $(LIBS) -I../mDNSShared -Wall -o $@
67c8f8a1 58
32bb7e43 59build/dns-sd64: build dns-sd.c ClientCommon.c
f0cc3e7b 60 $(CC) $(SUPMAKE_CFLAGS) $(filter %.c %.o, $+) $(LIBS) -I../mDNSShared -Wall -o $@ -m64
67c8f8a1
A
61
62# Note, we can make a 'fat' version of dns-sd using 'lipo', as shown below, but we
63# don't, because we don't want or need a 'fat' version of dns-sd, because it will
64# never need to access more than 4GB of data. We build the 64-bit version purely so
65# we have a test tool for making sure that the APIs work properly from 64-bit clients.
66# lipo -create dns-sd dns-sd64 -output dns-sd-fat