forked from alblue/mac-zfs
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile-maczfs
524 lines (428 loc) · 29.2 KB
/
Makefile-maczfs
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
# -*- mode: makefile -*-
#
# gmake based Makefiles for maczfs.
#
# This file describes a set of related build targets. It does not do
# the actual build, but merely describes what to build and which
# ingredients go into that specific build.
#
# The format is straight-forward:
#
# 1) first specify the targets.
# 2) for each target, specify sources files, install files and used libraries.
# 3) at the very end, include Makefile.Rules.
#
# Build host specific definitions should go into Makefile-host.
#
# For example, if you get weired linker errors or missing / doubled
# definitions, then make sure your CPATH and LIBRARY_PATH do not contain
# unwanted extra includes or libraries.
#
# Example: fix library problems with macports & Co.
#CPATH :=
#export CPATH
#LIBRARY_PATH :=
#export LIBRARY_PATH
# 1) what to build
#
# specify executables, libraries and kernel extensions. Do *not* use
# extensions like ".exe" or ".a" etc.!
#
# here go all normal executable files:
ALL_EXE := zfs zpool zfsutil zoink zdb ztest ztest_static zdb_static
#
# here go all libraries build in this folder. Do not specify
# libraries used here but build elsewhere!
ALL_LIBS := libzfs libnsl libnvpair libzpool
#
# all kernel extensions
ALL_KEXT := zfskext
# 2) what makes up a target.
#
# specify the sources *including* path, starting form project root,
# i.e. starting with usr/src/...
#
# NOTE: It is currently NOT supported to have two source files of the
# same name but in different directories within one target!
#
# Targets are specified using a set of variables, all prefixed with the
# target's name and an underscore. The available variables are:
#
# tget_SOURCES : all source files
# tget_ARCH : the architectures to build. Defaults to all available.
# tget_LIBS : used libraries for this project. specify just the
# library name i.e. libzfs, without an extension. Linkage will be
# dynamic if supported, static otherwise. To force either one, add
# the library (w/o extension) to tget_LIBS_DY or tget_LIBS_AR.
# tget_LDLIBS : additional system libraries to link in. Specify as
# for the dynamic linker, i.e. use "-lc" to link in libc. Only
# evaluated when creating a dynamic library.
# tget_INC : additional include directories to use.
# tget_INCSYS : additional system include directories to be added
# with "-isystem".
# tget_INSTHDRS : list of header files that should be installed along a
# library.
# tget_INSTHDRSDIR : directory where to install the headers. This is
# interpreted relative to the install base defined in
# Makefile-host. Defaults to an architecture specific path.
# tget_CFLAGS : extra flags to pass to the compiler
# tget_CXXFLAGS : same for C++ code
# tget_LDFLAGS : extra flags to pass to the (dynamic) linker
# tget_DYLIB : what type of library to build. Empty or NO for static
# library and YES for a dynamic library. Only allowed in a library
# target specification.
# tget_VERS : version information for a dynamic library. Should be
# a single integer. Mandatory for dynamic libraries.
# tget_INSTARLIB : wether or not to install a static library. YES to
# install (in tget_INSTLIBDIR), empty or NO otherwise. Automatically
# set to YES if tget_DYLIB is YES but dynamic libraries are not
# supported by the current architecture.
# tget_INSTLIBDIR : directory where to install dynamic libraries. This
# is interpreted relative to the install base defined in Makefile-host.
# Defaults to an architecture dependent path.
# tget_INSTEXEDIR : directory where to install executable files. This
# is interpreted relative to the install base defined in Makefile-host.
# Defaults to an architecture dependent path.
# tget_VERSION : file version number. If set, then a special file
# tget_vers.c will be generated which provides Apple's executable file
# version mechanism. The version number should be in the format of
# a.b.c with a,b and c positive integer numbers.
# tget_DESCRIPTION : Optional longer, free-text description, for example
# a tag from a SCM system. Ignored if tget_VERSION is empty.
# tget_VERS_C : name of a user-supplied version info file.
# Overrides the auto-generated one from tget_VERSION. Must be a
# compilable C source including path relative to project root. If
# set, then this is used independently of tget_VERSION being defined
# or not.
#
# All variables, with the exception of tget_ARCH, can be prefixed with
# an architecture to apply same flags, libraries, sources or other
# settings only for the given architecture, e.g. tget_ppc_CFLAGS :=
# xxx. For most variables, the architecture specific value is
# appended to the generic value. The architecture specific values for
# the variables DYLIB, VERS, INSTHDRSDIR, INSTLIBDIR, INSTEXEDIR,
# INSTKEXTDIR, INSTARLIB, VERSION, DESCRIPTION and VERS_C override the
# respective generic values.
#
# You can invent other variables to simplify filling in above
# variables. Any such invented variables should use lower case, since
# upper case names are reserved for the build system's internal use.
# See README_buildsystem.txt file for a list of used variables.
src := usr/src
# base identifier. note that this is only the prefix, the string
# ".zfs.fs" will be added.
identifier ?= org.maczfs
maczfs_id := $(identifier).zfs.fs
maczfs_version_desc := $(shell git describe --tags --long --match 'maczfs*' 2> /dev/null)
maczfs_version_num := $(shell echo $(maczfs_version_desc) | awk -f support/version.awk)
# splitting a version string like "1.2.3" into its parts isn't exactly
# easy within make. So we have to do some work here:
maczfs_version_list := $(subst ., ,$(maczfs_version_num))
maczfs_version_major := $(word 1,$(maczfs_version_list))
maczfs_version_minor := $(word 2,$(maczfs_version_list))
maczfs_version_patch := $(word 3,$(maczfs_version_list))
maczfs_vers_m_m_p_def := -DMACZFS_VERS_LIST="$(maczfs_version_list)" -DMACZFS_VERS_MAJOR=$(maczfs_version_major) -DMACZFS_VERS_MINOR=$(maczfs_version_minor) -DMACZFS_VERS_PATCH=$(maczfs_version_patch)
libzfs_SOURCES := $(addprefix $(src)/common/,avl/avl.c devid/devid.c nvpair/nvpair.c nvpair/nvpair_alloc_fixed.c util/qsort.c zfs/zfs_deleg.c zfs/zfs_namecheck.c zfs/zfs_prop.c)
libzfs_SOURCES += $(addprefix $(src)/lib/,libdevid/deviceid.c libnsl/rpc/xdr.c libnsl/rpc/xdr_array.c libnsl/rpc/xdr_mem.c libnvpair/libnvpair.c libnvpair/nvpair_alloc_system.c)
libzfs_SOURCES += $(addprefix $(src)/lib/libuutil/common/,uu_alloc.c uu_avl.c uu_dprintf.c uu_ident.c uu_list.c uu_misc.c uu_open.c uu_pname.c uu_strtoint.c)
libzfs_SOURCES += $(addprefix $(src)/lib/libzfs/common/,libzfs_changelist.c libzfs_config.c libzfs_dataset.c libzfs_graph.c libzfs_import.c libzfs_mount.c libzfs_pool.c libzfs_status.c libzfs_util.c)
libzfs_SOURCES += $(addprefix $(src)/,libgen/common/mkdirp.c maczfs/assfail.c)
libzfs_DYLIB := YES
libzfs_INSTARLIB := YES
libzfs_VERS := 1
libzfs_LDLIBS := -lc
libzfs_CFLAGS := -include usr/src/uts/common/fs/zfs/sys/zfs_context.h -include usr/src/uts/common/sys/types.h -DTEXT_DOMAIN=0
libzfs_INCSYS := $(addprefix $(src)/,maczfs libgen/common lib/libzfs/common lib/libuutil/common common/zfs) $(addprefix $(src)/lib/,libdevid libnsl/rpc libnsl/include libnvpair) $(addprefix $(src)/,head uts/common uts/common/fs/zfs lib uts/common/sys) $(src)
libzfs_VERSION := $(maczfs_version_num)
libzfs_DESCRIPTION := $(maczfs_version_desc)
libzfs_CFLAGS += -DMACZFS_ID=$(maczfs_id) $(maczfs_vers_m_m_p_def)
libzfs_INSTHDRS := $(addprefix $(src)/common/,devid/devid_impl.h util/qsort.h zfs/zfs_deleg.h zfs/zfs_namecheck.h zfs/zfs_prop.h)
libzfs_INSTHDRS += $(addprefix $(src)/lib/,libdevid/libdevid.h libnsl/include/mt.h libnsl/rpc/rpc_mt.h libnvpair/libnvpair.h libuutil/common/libuutil.h libuutil/common/libuutil_common.h libuutil/common/libuutil_impl.h libzfs/common/libzfs.h libzfs/common/libzfs_impl.h libzfs/common/libzfs_ioctl.h)
libzfs_INSTHDRS += $(addprefix $(src)/uts/common/,fs/zfs/sys/zvol.h rpc/types.h rpc/xdr.h sys/fs/zfs.h sys/mntent.h sys/mnttab.h)
libzfs_ppc_CFLAGS := -DMAC_OS_X_VERSION_MIN_REQUIRED=MAC_OS_X_VERSION_10_5 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk
libzfs_i386_5_CFLAGS := $(libzfs_ppc_CFLAGS)
zfs_SOURCES := $(addprefix $(src)/,cmd/zfs/zfs_iter.c cmd/zfs/zfs_main.c maczfs/assfail.c)
zfs_LIBS := libzfs
zfs_LDLIBS := -lc
zfs_CFLAGS := -include usr/src/uts/common/fs/zfs/sys/zfs_context.h -include usr/src/uts/common/sys/types.h
zfs_INCSYS := $(addprefix $(src)/,head uts/common/fs/zfs uts/common cmd/zfs maczfs lib/libzfs/common lib/libuutil/common lib/libnvpair) $(src)
zfs_INSTEXEDIR := usr/sbin
zfs_VERSION := $(maczfs_version_num)
zfs_DESCRIPTION := $(maczfs_version_desc)
zfs_CFLAGS += -DMACZFS_ID=$(maczfs_id) $(maczfs_vers_m_m_p_def)
zfs_ppc_CFLAGS := -DMAC_OS_X_VERSION_MIN_REQUIRED=MAC_OS_X_VERSION_10_5 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk
zfs_i386_5_CFLAGS := $(zfs_ppc_CFLAGS)
zpool_SOURCES := $(addprefix $(src)/,cmd/zpool/zpool_iter.c cmd/zpool/zpool_main.c cmd/zpool/zpool_util.c cmd/zpool/zpool_vdev.c maczfs/assfail.c)
zpool_LIBS := libzfs
zpool_LDLIBS := -lc
zpool_CFLAGS := -include usr/src/uts/common/fs/zfs/sys/zfs_context.h -include usr/src/uts/common/sys/types.h
zpool_INCSYS := $(addprefix $(src)/,head uts/common/fs/zfs uts/common cmd/zpool maczfs lib/libzfs/common lib/libuutil/common lib/libnvpair) $(src)
zpool_INSTEXEDIR := usr/sbin
zpool_VERSION := $(maczfs_version_num)
zpool_DESCRIPTION := $(maczfs_version_desc)
zpool_CFLAGS += -DMACZFS_ID=$(maczfs_id) $(maczfs_vers_m_m_p_def)
zpool_ppc_CFLAGS := -DMAC_OS_X_VERSION_MIN_REQUIRED=MAC_OS_X_VERSION_10_5 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk
zpool_i386_5_CFLAGS := $(zpool_ppc_CFLAGS)
zfsutil_SOURCES := zfs_bundle/zfsutil.c $(src)/maczfs/assfail.c
zfsutil_INSTNAME := zfs.util
zfsutil_LIBS := libzfs
zfsutil_LDLIBS := -lc
zfsutil_CFLAGS := -include usr/src/uts/common/fs/zfs/sys/zfs_context.h -include usr/src/uts/common/sys/types.h
zfsutil_INCSYS := $(addprefix $(src)/,head uts/common/fs/zfs uts/common cmd/zpool maczfs lib/libzfs/common lib/libuutil/common lib/libnvpair) $(src)
zfsutil_INSTEXEDIR := System/Library/Filesystems/zfs.fs
zfsutil_VERSION := $(maczfs_version_num)
zfsutil_DESCRIPTION := $(maczfs_version_desc)
zfsutil_CFLAGS += -DMACZFS_ID=$(maczfs_id) $(maczfs_vers_m_m_p_def)
zfsutil_ppc_CFLAGS := -DMAC_OS_X_VERSION_MIN_REQUIRED=MAC_OS_X_VERSION_10_5 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk
zfsutil_i386_5_CFLAGS := $(zfsutil_ppc_CFLAGS)
zoink_SOURCES := zfs_commands/zoink/zoink.c $(src)/maczfs/assfail.c
zoink_LIBS := libzfs
zoink_LDLIBS := -lc -lcurses
zoink_CFLAGS := -include usr/src/uts/common/fs/zfs/sys/zfs_context.h -include usr/src/uts/common/sys/types.h
zoink_INCSYS := $(addprefix $(src)/,head uts/common/fs/zfs uts/common cmd/zpool maczfs lib/libzfs/common lib/libuutil/common lib/libnvpair) $(src)
zoink_INSTEXEDIR := usr/local/bin
zoink_VERSION := $(maczfs_version_num)
zoink_DESCRIPTION := $(maczfs_version_desc)
zoink_CFLAGS += -DMACZFS_ID=$(maczfs_id) $(maczfs_vers_m_m_p_def)
zoink_ppc_CFLAGS := -DMAC_OS_X_VERSION_MIN_REQUIRED=MAC_OS_X_VERSION_10_5 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk
zoink_i386_5_CFLAGS := $(zoink_ppc_CFLAGS)
zfskext_SOURCES := $(addprefix $(src)/common/,avl/avl.c nvpair/nvpair.c util/qsort.c zfs/zfs_deleg.c zfs/zfs_namecheck.c zfs/zfs_prop.c)
zfskext_SOURCES += $(addprefix $(src)/maczfs/,assfail.c kernel/maczfs_kernel.c kernel/zfs_context.c)
zfskext_SOURCES += $(addprefix $(src)/uts/common/fs/zfs/,arc.c bplist.c dbuf.c dmu.c dmu_object.c dmu_objset.c dmu_send.c dmu_traverse.c dmu_tx.c dmu_zfetch.c)
zfskext_SOURCES += $(addprefix $(src)/uts/common/fs/zfs/,dnode.c dnode_sync.c dsl_dataset.c dsl_deleg.c dsl_dir.c dsl_pool.c dsl_prop.c dsl_synctask.c fletcher.c gzip.c lzjb.c metaslab.c refcount.c)
zfskext_SOURCES += $(addprefix $(src)/uts/common/fs/zfs/,rprwlock.c sha256.c spa.c spa_config.c spa_errlog.c spa_history.c spa_misc.c space_map.c txg.c uberblock.c unique.c vdev.c vdev_cache.c)
zfskext_SOURCES += $(addprefix $(src)/uts/common/fs/zfs/,vdev_disk.c vdev_file.c vdev_label.c vdev_mirror.c vdev_missing.c vdev_queue.c vdev_raidz.c vdev_root.c zap.c zap_leaf.c zap_micro.c)
zfskext_SOURCES += $(addprefix $(src)/uts/common/fs/zfs/,zfs_acl.c zfs_byteswap.c zfs_ctldir.c zfs_dir.c zfs_fm.c zfs_ioctl.c zfs_log.c zfs_replay.c zfs_rlock.c zfs_vfsops.c zfs_vnops.c)
zfskext_SOURCES += $(addprefix $(src)/uts/common/fs/zfs/,zfs_vnops_macosx.c zfs_znode.c zil.c zio.c zio_checksum.c zio_compress.c zio_inject.c zvol.c)
zfskext_SOURCES += $(addprefix $(src)/uts/common/os/,callb.c kmem.c list.c nvpair_alloc_system.c taskq.c)
zfskext_SOURCES += $(addprefix $(src)/uts/common/rpc/,xdr.c xdr_array.c xdr_mem.c) $(src)/uts/common/zmod/zmod.c
zfskext_CFLAGS := -mkernel -DNAMEDSTREAMS -D__APPLE_API_UNSTABLE -D_KERNEL -DKERNEL -DKERNEL_PRIVATE -DDRIVER_PRIVATE
zfskext_CFLAGS += -nostdinc -finline -fno-keep-inline-functions -Wmissing-prototypes -Wunused-function -Wunused-label -w -Wshadow -Wno-deprecated-declarations
zfskext_CFLAGS += -include $(src)/uts/common/fs/zfs/sys/zfs_context.h -include $(src)/uts/common/sys/types.h
zfskext_INC :=
zfskext_LDFLAGS := -lcpp_kext -Xlinker -kext -nostdlib -lkmodc++ -lkmod -lcc_kext
zfskext_KEXT_START := zfs_module_start
zfskext_KEXT_STOP := zfs_module_stop
zfskext_KEXT_ID := $(maczfs_id)
zfskext_KEXT_DESCRIPTION := $(maczfs_version_desc)
zfskext_KEXT_VERSION := $(maczfs_version_num)
zfskext_KEXT_PLIST := zfs_kext/Info.plist
zfskext_VERSION := $(zfskext_KEXT_VERSION)
zfskext_DESCRIPTION := $(zfskext_KEXT_DESCRIPTION)
zfskext_CFLAGS += -DMACZFS_ID=$(maczfs_id) $(maczfs_vers_m_m_p_def)
zfskext_INSTNAME := zfs
zfskext_INSTKEXTDIR := System/Library/Extensions
zfskext_KEXT_KERNEL := /mach_kernel
zfskext_i386_CFLAGS := -DMAC_OS_X_VERSION_MIN_REQUIRED=MAC_OS_X_VERSION_10_6
zfskext_i386_INC := $(src) $(addprefix $(src)/,maczfs common/avl common/nvpair common/util common/zfs maczfs/kernel uts/common/ uts/common/fs uts/common/os uts/common/rpc uts/common/zmod uts/common/fs/zfs common) /System/Library/Frameworks/Kernel.framework/PrivateHeaders /System/Library/Frameworks/Kernel.framework/Headers
zfskext_x86_64_CFLAGS := -DMAC_OS_X_VERSION_MIN_REQUIRED=MAC_OS_X_VERSION_10_6
zfskext_x86_64_INC := $(src) $(addprefix $(src)/,maczfs common/avl common/nvpair common/util common/zfs maczfs/kernel uts/common/ uts/common/fs uts/common/os uts/common/rpc uts/common/zmod uts/common/fs/zfs common) /System/Library/Frameworks/Kernel.framework/PrivateHeaders /System/Library/Frameworks/Kernel.framework/Headers
zfskext_ppc_CFLAGS := -DMAC_OS_X_VERSION_MIN_REQUIRED=MAC_OS_X_VERSION_10_5 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk
zfskext_ppc_INC := $(src) $(addprefix $(src)/,maczfs common/avl common/nvpair common/util common/zfs maczfs/kernel uts/common/ uts/common/fs uts/common/os uts/common/rpc uts/common/zmod uts/common/fs/zfs common) $(addprefix /Developer/SDKs/MacOSX10.5.sdk,/System/Library/Frameworks/Kernel.framework/PrivateHeaders /System/Library/Frameworks/Kernel.framework/Headers)
zfskext_i386_5_CFLAGS := -DMAC_OS_X_VERSION_MIN_REQUIRED=MAC_OS_X_VERSION_10_5 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk
zfskext_i386_5_INC := $(src) $(addprefix $(src)/,maczfs common/avl common/nvpair common/util common/zfs maczfs/kernel uts/common/ uts/common/fs uts/common/os uts/common/rpc uts/common/zmod uts/common/fs/zfs common) $(addprefix /Developer/SDKs/MacOSX10.5.sdk,/System/Library/Frameworks/Kernel.framework/PrivateHeaders /System/Library/Frameworks/Kernel.framework/Headers)
libnsl_SOURCES := $(addprefix $(src)/lib/libnsl/rpc/,xdr.c xdr_array.c xdr_mem.c)
libnsl_INSTHDRS :=
libnsl_DYLIB := NO
libnsl_VERS := 1
libnsl_INSTARLIB := YES
libnsl_INC := $(src)/lib/libnsl/rpc $(src)/lib/libnsl/include
libnsl_CFLAGS := -include usr/src/uts/common/fs/zfs/sys/zfs_context.h -include usr/src/uts/common/sys/types.h -DTEXT_DOMAIN=0
libnsl_INCSYS := $(src)/uts/common $(src)/uts/common/fs/zfs $(src)
libnsl_VERSION := $(maczfs_version_num)
libnsl_DESCRIPTION := $(maczfs_version_desc)
libnsl_ppc_CFLAGS := -DMAC_OS_X_VERSION_MIN_REQUIRED=MAC_OS_X_VERSION_10_5 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk
libnsl_i386_5_CFLAGS := $(libnsl_ppc_CFLAGS)
libnvpair_SOURCES := $(addprefix $(src)/lib/libnvpair/,libnvpair.c nvpair_alloc_system.c) $(addprefix $(src)/common/nvpair/,nvpair_alloc_fixed.c nvpair.c)
libnvpair_INSTHDRS := $(src)/lib/libnvpair/libnvpair.h
libnvpair_DYLIB := NO
libnvpair_VERS := 1
libnvpair_INSTARLIB := YES
libnvpair_CFLAGS := -include usr/src/uts/common/fs/zfs/sys/zfs_context.h -include usr/src/uts/common/sys/types.h -DTEXT_DOMAIN=0
libnvpair_INCSYS := $(src)/uts/common $(src)/uts/common/fs/zfs $(src)
libnvpair_INSTEXEDIR := usr/local/lib
libnvpair_VERSION := $(maczfs_version_num)
libnvpair_DESCRIPTION := $(maczfs_version_desc)
libnvpair_ppc_CFLAGS := -DMAC_OS_X_VERSION_MIN_REQUIRED=MAC_OS_X_VERSION_10_5 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk
libnvpair_i386_5_CFLAGS := $(libnvpair_ppc_CFLAGS)
libzpool_SOURCES := $(addprefix $(src)/common/,avl/avl.c)
libzpool_SOURCES += $(addprefix $(src)/common/,zfs/zfs_deleg.c zfs/zfs_namecheck.c zfs/zfs_prop.c)
libzpool_SOURCES += $(addprefix $(src)/uts/common/fs/zfs/,arc.c bplist.c dbuf.c dmu.c dmu_object.c dmu_objset.c dmu_send.c dmu_traverse.c dmu_tx.c dmu_zfetch.c)
libzpool_SOURCES += $(addprefix $(src)/uts/common/fs/zfs/,dnode.c dnode_sync.c dsl_dataset.c dsl_deleg.c dsl_dir.c dsl_pool.c dsl_prop.c dsl_synctask.c fletcher.c gzip.c lzjb.c metaslab.c refcount.c)
libzpool_SOURCES += $(addprefix $(src)/uts/common/fs/zfs/,rprwlock.c sha256.c spa.c spa_config.c spa_errlog.c spa_history.c spa_misc.c space_map.c txg.c uberblock.c unique.c vdev.c vdev_cache.c)
libzpool_SOURCES += $(addprefix $(src)/uts/common/fs/zfs/,vdev_file.c vdev_label.c vdev_mirror.c vdev_missing.c vdev_queue.c vdev_raidz.c vdev_root.c zap.c zap_leaf.c zap_micro.c)
libzpool_SOURCES += $(addprefix $(src)/uts/common/fs/zfs/,zfs_byteswap.c)
libzpool_SOURCES += $(src)/uts/common/fs/zfs/zfs_fm.c
libzpool_SOURCES += $(addprefix $(src)/uts/common/fs/zfs/,zfs_znode.c zil.c zio.c zio_checksum.c zio_compress.c zio_inject.c)
libzpool_SOURCES += $(src)/uts/common/os/list.c
libzpool_SOURCES += $(addprefix $(src)/lib/libzpool/common/,kernel.c taskq.c util.c)
libzpool_SOURCES += $(src)/maczfs/zfs_context_libzpool.c $(src)/maczfs/assfail.c
libzpool_DYLIB := YES
libzpool_VERS := 1
libzpool_INSTARLIB := YES
libzpool_LIBS := libnsl libnvpair
libzpool_LDLIBS := -lc -lz
libzpool_INC := $(addprefix $(src)/,head lib lib/libzfs lib/libuutil lib/libuutil/common lib/libnvpair)
libzpool_INC += $(addprefix $(src)/,lib/libzfs/common lib/libzpool/common libgen/common common)
libzpool_INC += $(addprefix $(src)/,common/zfs uts/common uts/common/fs uts/common/fs/zfs)
libzpool_INC += $(addprefix $(src)/,uts/common/sys)
libzpool_CFLAGS := $(addprefix -D,TEXT_DOMAIN=0 LIBZPOOL_HACK __APPLE_API_UNSTABLE NAMEDSTREAMS=1)
libzpool_inc_cflags := -include $(src)/lib/libzpool/common/sys/zfs_context.h -include $(src)/uts/common/sys/types.h
libzpool_VERSION := $(maczfs_version_num)
libzpool_DESCRIPTION := $(maczfs_version_desc)
libzpool_i386_CFLAGS := -DMAC_OS_X_VERSION_MIN_REQUIRED=MAC_OS_X_VERSION_10_6 $(libzpool_inc_cflags)
libzpool_x86_64_CFLAGS := -DMAC_OS_X_VERSION_MIN_REQUIRED=MAC_OS_X_VERSION_10_6 $(libzpool_inc_cflags)
libzpool_INCSYS := $(addprefix $(src)/,uts/common head uts/common/sys, maczfs)
libzpool_ppc_CFLAGS := -DMAC_OS_X_VERSION_MIN_REQUIRED=MAC_OS_X_VERSION_10_5 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk $(libzpool_inc_cflags)
libzpool_i386_5_CFLAGS := $(libzpool_ppc_CFLAGS)
ztest_SOURCES := $(src)/cmd/ztest/ztest.c
ztest_LIBS := libzpool
ztest_LDLIBS := -lc
ztest_CFLAGS := -include $(src)/uts/common/sys/types.h -include $(src)/lib/libzpool/common/sys/zfs_context.h
ztest_INCSYS := $(addprefix $(src)/,head uts/common/fs/zfs uts/common uts/common/sys cmd/zpool maczfs lib/libzfs/common lib/libuutil/common lib/libnvpair lib/libzpool/common) $(src)
ztest_INSTEXEDIR := usr/sbin
ztest_VERSION := $(maczfs_version_num)
ztest_DESCRIPTION := $(maczfs_version_desc)
ztest_ppc_CFLAGS := -DMAC_OS_X_VERSION_MIN_REQUIRED=MAC_OS_X_VERSION_10_5 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk
ztest_i386_5_CFLAGS := $(ztest_ppc_CFLAGS)
ztest_static_SOURCES := $(ztest_SOURCES)
ztest_static_LIBS_AR := $(ztest_LIBS)
ztest_static_LDLIBS := $(ztest_LDLIBS) -lz
ztest_static_CFLAGS := -DZDB_STATIC=zdb_static $(ztest_CFLAGS)
ztest_static_INCSYS := $(ztest_INCSYS)
ztest_static_INSTEXEDIR := usr/sbin
ztest_static_VERSION := $(maczfs_version_num)
ztest_static_DESCRIPTION := $(maczfs_version_desc)
ztest_static_ppc_CFLAGS := $(ztest_ppc_CFLAGS)
ztest_static_i386_5_CFLAGS := $(ztest_ppc_CFLAGS)
zdb_SOURCES := $(addprefix $(src)/cmd/zdb/,zdb.c zdb_il.c)
zdb_LIBS := libzfs libzpool
zdb_LDLIBS := -lc
zdb_CFLAGS := -include $(src)/uts/common/sys/types.h -include $(src)/lib/libzpool/common/sys/zfs_context.h
zdb_INCSYS := $(addprefix $(src)/,head uts/common/fs/zfs uts/common uts/common/sys cmd/zpool maczfs lib/libzfs/common lib/libuutil/common lib/libnvpair lib/libzpool/common) $(src)
zdb_INSTEXEDIR := usr/sbin
zdb_VERSION := $(maczfs_version_num)
zdb_DESCRIPTION := $(maczfs_version_desc)
zdb_ppc_CFLAGS := -DMAC_OS_X_VERSION_MIN_REQUIRED=MAC_OS_X_VERSION_10_5 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk
zdb_i386_5_CFLAGS := $(zdb_ppc_CFLAGS)
zdb_static_SOURCES := $(zdb_SOURCES)
zdb_static_LIBS_AR := $(zdb_LIBS)
zdb_static_LDLIBS := $(zdb_LDLIBS) -lz
zdb_static_CFLAGS := $(zdb_CFLAGS)
zdb_static_INCSYS := $(zdb_INCSYS)
zdb_static_INSTEXEDIR := $(zdb_INSTEXEDIR)
zdb_static_VERSION := $(maczfs_version_num)
zdb_static_DESCRIPTION := $(maczfs_version_desc)
zdb_static_ppc_CFLAGS := $(zdb_ppc_CFLAGS)
zdb_static_i386_5_CFLAGS := $(zdb_ppc_CFLAGS)
# 3) include Makefile.Rules
#
# This has all the magic that does the actual multi-architecture builds.
include ./Makefile.Rules
.PHONY: release
export $(foreach i2,$(ARCH_AVAIL),$(foreach i,$(ALL_EXE),$(i)_$(i2)_INSTEXEDIR_FIN))
export $(foreach i2,$(ARCH_AVAIL),$(foreach i,$(ALL_EXE),$(i)_$(i2)_INSTNAME_FIN))
export $(foreach i2,$(ARCH_AVAIL),$(foreach i,$(ALL_LIBS),$(i)_$(i2)_INSTLIBDIR_FIN))
export $(foreach i2,$(ARCH_AVAIL),$(foreach i,$(ALL_LIBS),$(i)_$(i2)_INSTNAME_FIN))
export $(foreach i2,$(ARCH_AVAIL),$(foreach i,$(ALL_KEXT),$(i)_$(i2)_INSTKEXTDIR_FIN))
export $(foreach i2,$(ARCH_AVAIL),$(foreach i,$(ALL_KEXT),$(i)_$(i2)_INSTNAME_FIN))
install_version := $(shell ./support/version.sh)
build_user := $(shell id -un)
build_group := $(shell id -gn)
install_user := root
install_group := wheel
.PHONY: install_man install_dsym
install_man:
mkdir -pv build/ZFS105/usr/share/man build/ZFS106/usr/share/man
cp -vr zfs_documentation/man8 build/ZFS105/usr/share/man/
cp -vr zfs_documentation/man8 build/ZFS106/usr/share/man/
install_dsym: install
for i in $(ARCH_AVAIL) ; do \
for i2 in $(ALL_EXE) ; do \
mydir=$${i2}_$${i}_INSTEXEDIR_FIN ; \
myname=$${i2}_$${i}_INSTNAME_FIN ; \
dsymutil --verbose $(INSTBASE)/$${i}/$${!mydir}/$${!myname} ; \
done ; \
for i2 in $(ALL_LIBS) ; do \
mydir=$${i2}_$${i}_INSTLIBDIR_FIN ; \
myname=$${i2}_$${i}_INSTNAME_FIN ; \
if [ -e $(INSTBASE)/$${i}/$${!mydir}/$${!myname}.dylib ] ; then \
dsymutil --verbose $(INSTBASE)/$${i}/$${!mydir}/$${!myname}.dylib ; \
fi ; \
done ; \
for i2 in $(ALL_KEXT) ; do \
mydir=$${i2}_$${i}_INSTKEXTDIR_FIN ; \
myname=$${i2}_$${i}_INSTNAME_FIN ; \
dsymutil --verbose $(INSTBASE)/$${i}/$${!mydir}/$${!myname}.kext/Contents/MacOS/$${!myname} ; \
done ; \
done ;
release: install install_man
mkdir -pv build/ZFS105 build/ZFS106
@echo Preparing MacOS 10.6.x package
set -x -v ; for i in $(ALL_EXE) ; do n386=$${i}_i386_INSTEXEDIR_FIN; in386=$${i}_i386_INSTNAME_FIN; n64=$${i}_x86_64_INSTEXEDIR_FIN; in64=$${i}_x86_64_INSTNAME_FIN; p386=$(INSTBASE)/i386/$${!n386}/$${!in386}; mkdir -pv build/ZFS106/$${!n386}; lipo $${p386} $(INSTBASE)/x86_64/$${!n64}/$${!in64} -create -output build/ZFS106/$${!n386}/$${!in386} ; dsymutil --verbose build/ZFS106/$${!n386}/$${!in386} ; done
set -x -v ; for i in $(ALL_LIBS) ; do n386=$${i}_i386_INSTLIBDIR_FIN; in386=$${i}_i386_INSTNAME_FIN; n64=$${i}_x86_64_INSTLIBDIR_FIN; in64=$${i}_x86_64_INSTNAME_FIN; p386=$(INSTBASE)/i386/$${!n386}/$${!in386}; if [ -e "$${p386}.dylib" ] ; then mkdir -pv build/ZFS106/$${!n386}; lipo $${p386}.dylib $(INSTBASE)/x86_64/$${!n64}/$${!in64}.dylib -create -output build/ZFS106/$${!n386}/$${!in386}.dylib ; dsymutil --verbose build/ZFS106/$${!n386}/$${!in386}.dylib ; else echo "skipping archive $${i}" ; fi ; done
@echo
mkdir -pv build/ZFS106/$${zfskext_i386_INSTKEXTDIR_FIN}
cp -pr $(INSTBASE)/i386/$${zfskext_i386_INSTKEXTDIR_FIN}/zfs.kext build/ZFS106/$${zfskext_i386_INSTKEXTDIR_FIN}/
lipo $(INSTBASE)/i386/$${zfskext_i386_INSTKEXTDIR_FIN}/zfs.kext/Contents/MacOS/zfs $(INSTBASE)/x86_64/$${zfskext_i386_INSTKEXTDIR_FIN}/zfs.kext/Contents/MacOS/zfs -create -output build/ZFS106/$${zfskext_i386_INSTKEXTDIR_FIN}/zfs.kext/Contents/MacOS/zfs
dsymutil --verbose build/ZFS106/$${zfskext_i386_INSTKEXTDIR_FIN}/zfs.kext/Contents/MacOS/zfs
@echo
mkdir -pv build/ZFS106/System/Library/Filesystems/zfs.fs/Contents/Resources/English.lproj
cp -v zfs_bundle/Info.plist zfs_bundle/PkgInfo build/ZFS106/System/Library/Filesystems/zfs.fs/Contents/
cp -v zfs_bundle/VolumeIcon.icns build/ZFS106/System/Library/Filesystems/zfs.fs/Contents/Resources/
cp -vr zfs_bundle/English.lproj build/ZFS106/System/Library/Filesystems/zfs.fs/Contents/Resources/
@echo
@echo Preparing MacOS 10.5.x package
for i in $(ALL_EXE) ; do n386_5=$${i}_i386_5_INSTEXEDIR_FIN; in386_5=$${i}_i386_5_INSTNAME_FIN; nppc=$${i}_ppc_INSTEXEDIR_FIN; inppc=$${i}_ppc_INSTNAME_FIN; p386_5=$(INSTBASE)/i386_5/$${!n386_5}/$${!in386_5}; mkdir -pv build/ZFS105/$${!n386_5}; lipo $${p386_5} $(INSTBASE)/ppc/$${!nppc}/$${!inppc} -create -output build/ZFS105/$${!n386_5}/$${!in386_5} ; dsymutil --verbose build/ZFS105/$${!n386_5}/$${!in386_5} ; done
for i in $(ALL_LIBS) ; do n386_5=$${i}_i386_5_INSTLIBDIR_FIN; in386_5=$${i}_i386_5_INSTNAME_FIN; nppc=$${i}_ppc_INSTLIBDIR_FIN; inppc=$${i}_ppc_INSTNAME_FIN; p386_5=$(INSTBASE)/i386_5/$${!n386_5}/$${!in386_5}; if [ -e "$${p386_5}.dylib" ] ; then mkdir -pv build/ZFS105/$${!n386_5}; lipo $${p386_5}.dylib $(INSTBASE)/ppc/$${!nppc}/$${!inppc}.dylib -create -output build/ZFS105/$${!n386_5}/$${!in386_5}.dylib ; dsymutil --verbose build/ZFS105/$${!n386_5}/$${!in386_5}.dylib ; else echo "skipping archive $${i}" ; fi ; done
@echo
mkdir -pv build/ZFS105/$${zfskext_i386_5_INSTKEXTDIR_FIN}
cp -pr $(INSTBASE)/i386_5/$${zfskext_i386_5_INSTKEXTDIR_FIN}/zfs.kext build/ZFS105/$${zfskext_i386_5_INSTKEXTDIR_FIN}/
lipo $(INSTBASE)/i386_5/$${zfskext_i386_5_INSTKEXTDIR_FIN}/zfs.kext/Contents/MacOS/zfs $(INSTBASE)/ppc/$${zfskext_i386_5_INSTKEXTDIR_FIN}/zfs.kext/Contents/MacOS/zfs -create -output build/ZFS105/$${zfskext_i386_5_INSTKEXTDIR_FIN}/zfs.kext/Contents/MacOS/zfs
dsymutil --verbose build/ZFS105/$${zfskext_i386_5_INSTKEXTDIR_FIN}/zfs.kext/Contents/MacOS/zfs
@echo
mkdir -pv build/ZFS105/System/Library/Filesystems/zfs.fs/Contents/Resources/English.lproj
cp -v zfs_bundle/Info.plist zfs_bundle/PkgInfo build/ZFS105/System/Library/Filesystems/zfs.fs/Contents/
cp -v zfs_bundle/VolumeIcon.icns build/ZFS105/System/Library/Filesystems/zfs.fs/Contents/Resources/
cp -vr zfs_bundle/English.lproj build/ZFS105/System/Library/Filesystems/zfs.fs/Contents/Resources/
@echo
@echo Creating combined installer package
cp -vr support/MacZFS.pmdoc build/
sed -i~ -e "s/0\\.0\\.0/$(install_version)/g" build/MacZFS.pmdoc/*
sed -i~ -e "s/invalid.id/$(identifier)/g" build/MacZFS.pmdoc/* build/ZFS10?/System/Library/Filesystems/zfs.fs/Contents/Info.plist
find build/ZFS10? build/MacZFS.pmdoc -iname '*~' -print0 | xargs -0 rm -v
if [ "$(nodebug)" == "yes" ] ; then find build/ZFS10? -iname '*.dsym' -print0 | xargs -0 rm -vr ; fi
@echo
@echo "explicitly setting group and ownership, enter sudo password if prompted"
sudo chown -Rv $(install_user):$(install_group) build/ZFS10? build/MacZFS.pmdoc
tree -pug build/ZFS10? build/MacZFS.pmdoc
cd build && sudo packagemaker --doc MacZFS.pmdoc --version $(install_version) --title "Mac ZFS $(install_version)" --out MacZFS-$(install_version).pkg --target 10.5
sudo chown -R $(build_user):$(build_group) build/ZFS10? build/MacZFS.pmdoc build/MacZFS-$(install_version).pkg
.PHONY: install-sys install-sys-impl
install-sys: release install-sys-impl
@echo Done. Next reload kext.
install-sys-impl:
set -x -v ; rel=$$(uname -r) ; if [ "$${rel%.*}" == "10.3" ] ; then \
relsrc=build/ZFS105 ; \
else \
relsrc=build/ZFS106 ; \
fi ; \
sudo chown -Rv $(install_user):$(install_group) $${relsrc} ; \
find $${relsrc} -print0 | sudo xargs -0 chmod o-w ; \
sudo ditto $${relsrc}/ / ; \
sudo touch /$${zfskext_i386_5_INSTKEXTDIR_FIN}
sudo chown -R $(build_user):$(build_group) build/ZFS10? ;
install-sys-load:
sudo zpool status
if kextstat | grep -e "$(identifier).zfs.fs" ; then \
sudo kextutil -s /$${zfskext_i386_5_INSTKEXTDIR_FIN}/zfs.kext -A /$${zfskext_i386_5_INSTKEXTDIR_FIN}/zfs.kext ; \
rel=$$(uname -r) ; if [ "$${rel%.*}" == "10.3" ] ; then \
relsrc=build/ZFS105 ; \
else \
relsrc=build/ZFS106 ; \
fi ; \
cp -v /$${zfskext_i386_5_INSTKEXTDIR_FIN}/zfs.kext/$(identifier).zfs.fs.sym $${relsrc}/$${zfskext_i386_5_INSTKEXTDIR_FIN}/zfs.kext/ ; \
else \
echo "failed to load kext" ; \
false ; \
fi