3 # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
5 # Licensed under the GPL v2, see the file LICENSE in this tarball.
7 srcdir:=$(top_srcdir)/e2fsprogs
8 objdir:=$(top_builddir)/e2fsprogs
10 BLKID_SRC := cache.c dev.c devname.c devno.c blkid_getsize.c \
11 probe.c read.c resolve.c save.c tag.c
12 BLKID_SRCS := $(patsubst %,blkid/%, $(BLKID_SRC))
13 BLKID_OBJS := $(patsubst %.c,%.o, $(BLKID_SRCS))
15 E2P_SRC := fgetsetflags.c fgetsetversion.c pf.c iod.c mntopts.c \
16 feature.c ls.c uuid.c pe.c ostype.c ps.c hashstr.c \
18 E2P_SRCS := $(patsubst %,e2p/%, $(E2P_SRC))
19 E2P_OBJS := $(patsubst %.c,%.o, $(E2P_SRCS))
21 EXT2FS_SRC := gen_bitmap.c bitops.c ismounted.c mkjournal.c unix_io.c \
22 rw_bitmaps.c initialize.c bitmaps.c block.c \
23 ind_block.c inode.c freefs.c alloc_stats.c closefs.c \
24 openfs.c io_manager.c finddev.c read_bb.c alloc.c badblocks.c \
25 getsize.c getsectsize.c alloc_tables.c read_bb_file.c mkdir.c \
26 bb_inode.c newdir.c alloc_sb.c lookup.c dirblock.c expanddir.c \
27 dir_iterate.c link.c res_gdt.c icount.c get_pathname.c dblist.c \
28 dirhash.c version.c flushb.c unlink.c check_desc.c valid_blk.c \
29 ext_attr.c bmap.c dblist_dir.c ext2fs_inline.c swapfs.c
30 EXT2FS_SRCS := $(patsubst %,ext2fs/%, $(EXT2FS_SRC))
31 EXT2FS_OBJS := $(patsubst %.c,%.o, $(EXT2FS_SRCS))
33 UUID_SRC := compare.c gen_uuid.c pack.c parse.c unpack.c unparse.c \
35 UUID_SRCS := $(patsubst %,uuid/%, $(UUID_SRC))
36 UUID_OBJS := $(patsubst %.c,%.o, $(UUID_SRCS))
39 # for building out-of-tree we need to make sure that the directories to hold
40 # the object tree are created
41 $(patsubst %,$(objdir)/%, blkid e2fsck e2p ext2fs uuid):
44 # make sure that the directories are order-only prerequisites. Otherwise we
45 # may have object files created after the timestamp of the directory was
46 # updated which would lead to spurious rebuilds (as some of the dentries
47 # may be older than the dir itself).
48 $(patsubst %,$(objdir)/%,$(BLKID_OBJS)): $(objdir)/blkid/%.o: $(srcdir)/%.c|$(objdir)/blkid
49 $(patsubst %,$(objdir)/%,$(E2FSCK_OBJS)):$(objdir)/e2fsck/%.o:$(srcdir)/%.c|$(objdir)/e2fsck
50 $(patsubst %,$(objdir)/%,$(E2P_OBJS)): $(objdir)/e2p/%.o: $(srcdir)/%.c|$(objdir)/e2p
51 $(patsubst %,$(objdir)/%,$(EXT2FS_OBJS)):$(objdir)/ext2fs/%.o:$(srcdir)/%.c|$(objdir)/ext2fs
52 $(patsubst %,$(objdir)/%,$(UUID_OBJS)): $(objdir)/uuid/%.o: $(srcdir)/%.c|$(objdir)/uuid
55 E2FSPROGS-$(CONFIG_CHATTR) += chattr.o $(E2P_OBJS)
56 E2FSPROGS-$(CONFIG_E2FSCK) += e2fsck.o util.o $(BLKID_OBJS) $(EXT2FS_OBJS) $(UUID_OBJS)
57 E2FSPROGS-$(CONFIG_FSCK) += fsck.o util.o $(BLKID_OBJS) $(UUID_OBJS)
58 E2FSPROGS-$(CONFIG_LSATTR) += lsattr.o $(E2P_OBJS)
59 E2FSPROGS-$(CONFIG_MKE2FS) += mke2fs.o util.o $(E2P_OBJS) $(BLKID_OBJS) $(EXT2FS_OBJS) $(UUID_OBJS)
60 E2FSPROGS-$(CONFIG_TUNE2FS) += tune2fs.o util.o $(E2P_OBJS) $(BLKID_OBJS) $(EXT2FS_OBJS) $(UUID_OBJS)
62 E2FSPROGS-y:=$(sort $(E2FSPROGS-y))
63 ifneq ($(E2FSPROGS-y),)
64 CFLAGS-e2fsprogs := -include $(srcdir)/e2fsbb.h
67 E2FSPROGS_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(E2FSPROGS-y))
68 E2FSPROGS_SRC-a:=$(wildcard $(srcdir)/*.c) $(patsubst %,$(srcdir)/%,$(BLKID_SRCS) $(E2P_SRCS) $(EXT2FS_SRCS) $(UUID_SRCS))
69 APPLET_SRC-y+=$(E2FSPROGS_SRC-y)
70 APPLET_SRC-a+=$(E2FSPROGS_SRC-a)
72 $(warning FIXME: change .c to include their stuff relative to $(srcdir))
73 E2FSPROGS_TMP_KLUDGE:=$(patsubst %,-I$(srcdir)/%,blkid e2fsck e2p ext2fs uuid)
74 CFLAGS-blkid=$(E2FSPROGS_TMP_KLUDGE) $(CFLAGS-e2fsprogs)
75 CFLAGS-e2fsck=$(E2FSPROGS_TMP_KLUDGE) $(CFLAGS-e2fsprogs)
76 CFLAGS-e2p=$(E2FSPROGS_TMP_KLUDGE) $(CFLAGS-e2fsprogs)
77 CFLAGS-ext2fs=$(E2FSPROGS_TMP_KLUDGE) $(CFLAGS-e2fsprogs)
78 CFLAGS-uuid=$(E2FSPROGS_TMP_KLUDGE) $(CFLAGS-e2fsprogs)
81 APPLETS_DEFINE-y+=$(CFLAGS-e2fsprogs) -I$(srcdir) $(E2FSPROGS_TMP_KLUDGE)
82 APPLETS_DEFINE-a+=$(CFLAGS-e2fsprogs) -I$(srcdir) $(E2FSPROGS_TMP_KLUDGE)
84 e2fsprogs_OBJ:= $(patsubst %,$(objdir)/%,$(E2FSPROGS-y))