blob: 0ca1c976d1f213007c40e70bc9c1f04ace4ec2a7 [file] [log] [blame]
Mike Frysingerd89e5e62005-04-24 05:15:12 +00001# Makefile for busybox
2#
3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
4#
Mike Frysinger0d4ee682005-09-24 06:01:57 +00005# Licensed under the GPL v2, see the file LICENSE in this tarball.
Mike Frysingerd89e5e62005-04-24 05:15:12 +00006
Bernhard Reutner-Fischer5d261262006-03-01 22:54:48 +00007srcdir:=$(top_srcdir)/e2fsprogs
8objdir:=$(top_builddir)/e2fsprogs
Eric Andersen9cc7f322005-05-11 23:20:09 +00009
"Vladimir N. Oleynik"b71e6022005-09-19 13:48:39 +000010BLKID_SRC := cache.c dev.c devname.c devno.c blkid_getsize.c \
Bernhard Reutner-Fischerf24e0f52005-09-30 08:25:50 +000011 probe.c read.c resolve.c save.c tag.c
Mike Frysinger174808c2005-06-11 01:14:09 +000012BLKID_SRCS := $(patsubst %,blkid/%, $(BLKID_SRC))
13BLKID_OBJS := $(patsubst %.c,%.o, $(BLKID_SRCS))
14
15E2P_SRC := fgetsetflags.c fgetsetversion.c pf.c iod.c mntopts.c \
"Vladimir N. Oleynik"3978e552005-09-27 11:43:29 +000016 feature.c ls.c uuid.c pe.c ostype.c ps.c hashstr.c \
17 parse_num.c
Mike Frysingerf3d28842005-06-11 00:27:50 +000018E2P_SRCS := $(patsubst %,e2p/%, $(E2P_SRC))
19E2P_OBJS := $(patsubst %.c,%.o, $(E2P_SRCS))
Eric Andersen9cc7f322005-05-11 23:20:09 +000020
Mike Frysinger174808c2005-06-11 01:14:09 +000021EXT2FS_SRC := gen_bitmap.c bitops.c ismounted.c mkjournal.c unix_io.c \
"Vladimir N. Oleynik"3978e552005-09-27 11:43:29 +000022 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 \
Rob Landley391a9042006-01-23 21:38:06 +000029 ext_attr.c bmap.c dblist_dir.c ext2fs_inline.c swapfs.c
Mike Frysinger174808c2005-06-11 01:14:09 +000030EXT2FS_SRCS := $(patsubst %,ext2fs/%, $(EXT2FS_SRC))
31EXT2FS_OBJS := $(patsubst %.c,%.o, $(EXT2FS_SRCS))
32
33UUID_SRC := compare.c gen_uuid.c pack.c parse.c unpack.c unparse.c \
"Vladimir N. Oleynik"3978e552005-09-27 11:43:29 +000034 uuid_time.c
Mike Frysinger174808c2005-06-11 01:14:09 +000035UUID_SRCS := $(patsubst %,uuid/%, $(UUID_SRC))
36UUID_OBJS := $(patsubst %.c,%.o, $(UUID_SRCS))
37
Bernhard Reutner-Fischer5d261262006-03-01 22:54:48 +000038
Bernhard Reutner-Fischer5c071bc2005-10-05 07:40:46 +000039# for building out-of-tree we need to make sure that the directories to hold
40# the object tree are created
Bernhard Reutner-Fischer5d261262006-03-01 22:54:48 +000041$(patsubst %,$(objdir)/%, blkid e2fsck e2p ext2fs uuid):
Bernhard Reutner-Fischer7abe7092005-10-05 10:06:11 +000042 @mkdir -p "$@"
Bernhard Reutner-Fischer5c071bc2005-10-05 07:40:46 +000043
Bernhard Reutner-Fischer7abe7092005-10-05 10:06:11 +000044# 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).
Bernhard Reutner-Fischer07a79e72006-03-09 09:03:37 +000048ifeq ($(MAKE_VERSION),3.81beta4)
Bernhard Reutner-Fischer2e9cf372006-03-06 14:20:43 +000049# alleged bug in 3.81beta4. Stripping dir from dir/files.c
50# /top/obj/dir/*.o: /top/obj/dir/file.o: /top/src/file.c
51$(patsubst %,$(objdir)/%,$(BLKID_OBJS)): $(objdir)/blkid/%.o: $(srcdir)/%.c |$(objdir)/blkid
Bernhard Reutner-Fischer5d261262006-03-01 22:54:48 +000052$(patsubst %,$(objdir)/%,$(E2FSCK_OBJS)):$(objdir)/e2fsck/%.o:$(srcdir)/%.c|$(objdir)/e2fsck
Bernhard Reutner-Fischer2e9cf372006-03-06 14:20:43 +000053$(patsubst %,$(objdir)/%,$(E2P_OBJS)): $(objdir)/e2p/%.o: $(srcdir)/%.c |$(objdir)/e2p
Bernhard Reutner-Fischer5d261262006-03-01 22:54:48 +000054$(patsubst %,$(objdir)/%,$(EXT2FS_OBJS)):$(objdir)/ext2fs/%.o:$(srcdir)/%.c|$(objdir)/ext2fs
Bernhard Reutner-Fischer2e9cf372006-03-06 14:20:43 +000055$(patsubst %,$(objdir)/%,$(UUID_OBJS)): $(objdir)/uuid/%.o: $(srcdir)/%.c |$(objdir)/uuid
Bernhard Reutner-Fischer07a79e72006-03-09 09:03:37 +000056
57e2fsprogs-rules-seen:=1
Bernhard Reutner-Fischer2e9cf372006-03-06 14:20:43 +000058endif
Bernhard Reutner-Fischer5d261262006-03-01 22:54:48 +000059
Bernhard Reutner-Fischer07a79e72006-03-09 09:03:37 +000060ifeq ($(MAKE_VERSION),3.79.1)
61# no order-only prerequesites
62$(patsubst %,$(objdir)/%,$(BLKID_OBJS)): $(objdir)/blkid/%.o: $(srcdir)/blkid/%.c #|$(objdir)/blkid
63$(patsubst %,$(objdir)/%,$(E2FSCK_OBJS)):$(objdir)/e2fsck/%.o:$(srcdir)/e2fsck/%.c#|$(objdir)/e2fsck
64$(patsubst %,$(objdir)/%,$(E2P_OBJS)): $(objdir)/e2p/%.o: $(srcdir)/e2p/%.c #|$(objdir)/e2p
65$(patsubst %,$(objdir)/%,$(EXT2FS_OBJS)):$(objdir)/ext2fs/%.o:$(srcdir)/ext2fs/%.c#|$(objdir)/ext2fs
66$(patsubst %,$(objdir)/%,$(UUID_OBJS)): $(objdir)/uuid/%.o: $(srcdir)/uuid/%.c #|$(objdir)/uuid
67$(patsubst %,$(objdir)/%,$(BLKID_OBJS)): $(objdir)/blkid
68$(patsubst %,$(objdir)/%,$(E2FSCK_OBJS)):$(objdir)/e2fsck
69$(patsubst %,$(objdir)/%,$(E2P_OBJS)): $(objdir)/e2p
70$(patsubst %,$(objdir)/%,$(EXT2FS_OBJS)):$(objdir)/ext2fs
71$(patsubst %,$(objdir)/%,$(UUID_OBJS)): $(objdir)/uuid
72$(patsubst %,$(objdir)/%,$(BLKID_OBJS)): $(objdir)/blkid
73$(patsubst %,$(objdir)/%,$(E2FSCK_OBJS)):$(objdir)/e2fsck
74$(patsubst %,$(objdir)/%,$(E2P_OBJS)): $(objdir)/e2p
75$(patsubst %,$(objdir)/%,$(EXT2FS_OBJS)):$(objdir)/ext2fs
76$(patsubst %,$(objdir)/%,$(UUID_OBJS)): $(objdir)/uuid
77
78e2fsprogs-rules-seen:=1
79endif
80
81ifndef e2fsprogs-rules-seen
82$(patsubst %,$(objdir)/%,$(BLKID_OBJS)): $(objdir)/blkid/%.o: $(srcdir)/blkid/%.c |$(objdir)/blkid
83$(patsubst %,$(objdir)/%,$(E2FSCK_OBJS)):$(objdir)/e2fsck/%.o:$(srcdir)/e2fsck/%.c|$(objdir)/e2fsck
84$(patsubst %,$(objdir)/%,$(E2P_OBJS)): $(objdir)/e2p/%.o: $(srcdir)/e2p/%.c |$(objdir)/e2p
85$(patsubst %,$(objdir)/%,$(EXT2FS_OBJS)):$(objdir)/ext2fs/%.o:$(srcdir)/ext2fs/%.c|$(objdir)/ext2fs
86$(patsubst %,$(objdir)/%,$(UUID_OBJS)): $(objdir)/uuid/%.o: $(srcdir)/uuid/%.c |$(objdir)/uuid
87endif
88
89
Mike Frysinger174808c2005-06-11 01:14:09 +000090E2FSPROGS-$(CONFIG_CHATTR) += chattr.o $(E2P_OBJS)
Mike Frysingerdc251032005-10-05 00:52:37 +000091E2FSPROGS-$(CONFIG_E2FSCK) += e2fsck.o util.o $(BLKID_OBJS) $(EXT2FS_OBJS) $(UUID_OBJS)
"Vladimir N. Oleynik"d20cfbd2005-10-12 16:22:19 +000092E2FSPROGS-$(CONFIG_FSCK) += fsck.o util.o $(BLKID_OBJS) $(UUID_OBJS)
Mike Frysinger174808c2005-06-11 01:14:09 +000093E2FSPROGS-$(CONFIG_LSATTR) += lsattr.o $(E2P_OBJS)
Mike Frysinger6447ac02005-06-11 05:29:40 +000094E2FSPROGS-$(CONFIG_MKE2FS) += mke2fs.o util.o $(E2P_OBJS) $(BLKID_OBJS) $(EXT2FS_OBJS) $(UUID_OBJS)
Mike Frysinger174808c2005-06-11 01:14:09 +000095E2FSPROGS-$(CONFIG_TUNE2FS) += tune2fs.o util.o $(E2P_OBJS) $(BLKID_OBJS) $(EXT2FS_OBJS) $(UUID_OBJS)
Mike Frysingerd89e5e62005-04-24 05:15:12 +000096
Bernhard Reutner-Fischer7ca61b62006-01-15 14:04:57 +000097E2FSPROGS-y:=$(sort $(E2FSPROGS-y))
Bernhard Reutner-Fischer5d261262006-03-01 22:54:48 +000098ifneq ($(E2FSPROGS-y),)
99CFLAGS-e2fsprogs := -include $(srcdir)/e2fsbb.h
Rob Landleyd6e14d82006-02-21 19:11:35 +0000100endif
101
Bernhard Reutner-Fischer5d261262006-03-01 22:54:48 +0000102E2FSPROGS_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(E2FSPROGS-y))
103E2FSPROGS_SRC-a:=$(wildcard $(srcdir)/*.c) $(patsubst %,$(srcdir)/%,$(BLKID_SRCS) $(E2P_SRCS) $(EXT2FS_SRCS) $(UUID_SRCS))
104APPLET_SRC-y+=$(E2FSPROGS_SRC-y)
105APPLET_SRC-a+=$(E2FSPROGS_SRC-a)
Bernhard Reutner-Fischer7ca61b62006-01-15 14:04:57 +0000106
Bernhard Reutner-Fischer5d261262006-03-01 22:54:48 +0000107$(warning FIXME: change .c to include their stuff relative to $(srcdir))
108E2FSPROGS_TMP_KLUDGE:=$(patsubst %,-I$(srcdir)/%,blkid e2fsck e2p ext2fs uuid)
109CFLAGS-blkid=$(E2FSPROGS_TMP_KLUDGE) $(CFLAGS-e2fsprogs)
110CFLAGS-e2fsck=$(E2FSPROGS_TMP_KLUDGE) $(CFLAGS-e2fsprogs)
111CFLAGS-e2p=$(E2FSPROGS_TMP_KLUDGE) $(CFLAGS-e2fsprogs)
112CFLAGS-ext2fs=$(E2FSPROGS_TMP_KLUDGE) $(CFLAGS-e2fsprogs)
113CFLAGS-uuid=$(E2FSPROGS_TMP_KLUDGE) $(CFLAGS-e2fsprogs)
Bernhard Reutner-Fischer7ca61b62006-01-15 14:04:57 +0000114
Eric Andersen9cc7f322005-05-11 23:20:09 +0000115
Bernhard Reutner-Fischer5d261262006-03-01 22:54:48 +0000116APPLETS_DEFINE-y+=$(CFLAGS-e2fsprogs) -I$(srcdir) $(E2FSPROGS_TMP_KLUDGE)
117APPLETS_DEFINE-a+=$(CFLAGS-e2fsprogs) -I$(srcdir) $(E2FSPROGS_TMP_KLUDGE)
Mike Frysingerd89e5e62005-04-24 05:15:12 +0000118
Bernhard Reutner-Fischer5d261262006-03-01 22:54:48 +0000119e2fsprogs_OBJ:= $(patsubst %,$(objdir)/%,$(E2FSPROGS-y))
120
Bernhard Reutner-Fischer07a79e72006-03-09 09:03:37 +0000121$(e2fsprogs_OBJ): $(objdir)/%.o: $(srcdir)/%.c
122$(objdir)/e2fsprogs.a: $(e2fsprogs_OBJ)
123libraries-y:=$(libraries-y) $(objdir)/e2fsprogs.a
124