Mike Frysinger | d89e5e6 | 2005-04-24 05:15:12 +0000 | [diff] [blame] | 1 | # Makefile for busybox |
| 2 | # |
| 3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> |
| 4 | # |
Mike Frysinger | 0d4ee68 | 2005-09-24 06:01:57 +0000 | [diff] [blame] | 5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. |
Mike Frysinger | d89e5e6 | 2005-04-24 05:15:12 +0000 | [diff] [blame] | 6 | |
Bernhard Reutner-Fischer | 5d26126 | 2006-03-01 22:54:48 +0000 | [diff] [blame] | 7 | srcdir:=$(top_srcdir)/e2fsprogs |
| 8 | objdir:=$(top_builddir)/e2fsprogs |
Eric Andersen | 9cc7f32 | 2005-05-11 23:20:09 +0000 | [diff] [blame] | 9 | |
"Vladimir N. Oleynik" | b71e602 | 2005-09-19 13:48:39 +0000 | [diff] [blame] | 10 | BLKID_SRC := cache.c dev.c devname.c devno.c blkid_getsize.c \ |
Bernhard Reutner-Fischer | f24e0f5 | 2005-09-30 08:25:50 +0000 | [diff] [blame] | 11 | probe.c read.c resolve.c save.c tag.c |
Mike Frysinger | 174808c | 2005-06-11 01:14:09 +0000 | [diff] [blame] | 12 | BLKID_SRCS := $(patsubst %,blkid/%, $(BLKID_SRC)) |
| 13 | BLKID_OBJS := $(patsubst %.c,%.o, $(BLKID_SRCS)) |
| 14 | |
| 15 | E2P_SRC := fgetsetflags.c fgetsetversion.c pf.c iod.c mntopts.c \ |
"Vladimir N. Oleynik" | 3978e55 | 2005-09-27 11:43:29 +0000 | [diff] [blame] | 16 | feature.c ls.c uuid.c pe.c ostype.c ps.c hashstr.c \ |
| 17 | parse_num.c |
Mike Frysinger | f3d2884 | 2005-06-11 00:27:50 +0000 | [diff] [blame] | 18 | E2P_SRCS := $(patsubst %,e2p/%, $(E2P_SRC)) |
| 19 | E2P_OBJS := $(patsubst %.c,%.o, $(E2P_SRCS)) |
Eric Andersen | 9cc7f32 | 2005-05-11 23:20:09 +0000 | [diff] [blame] | 20 | |
Mike Frysinger | 174808c | 2005-06-11 01:14:09 +0000 | [diff] [blame] | 21 | EXT2FS_SRC := gen_bitmap.c bitops.c ismounted.c mkjournal.c unix_io.c \ |
"Vladimir N. Oleynik" | 3978e55 | 2005-09-27 11:43:29 +0000 | [diff] [blame] | 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 \ |
Rob Landley | 391a904 | 2006-01-23 21:38:06 +0000 | [diff] [blame] | 29 | ext_attr.c bmap.c dblist_dir.c ext2fs_inline.c swapfs.c |
Mike Frysinger | 174808c | 2005-06-11 01:14:09 +0000 | [diff] [blame] | 30 | EXT2FS_SRCS := $(patsubst %,ext2fs/%, $(EXT2FS_SRC)) |
| 31 | EXT2FS_OBJS := $(patsubst %.c,%.o, $(EXT2FS_SRCS)) |
| 32 | |
| 33 | UUID_SRC := compare.c gen_uuid.c pack.c parse.c unpack.c unparse.c \ |
"Vladimir N. Oleynik" | 3978e55 | 2005-09-27 11:43:29 +0000 | [diff] [blame] | 34 | uuid_time.c |
Mike Frysinger | 174808c | 2005-06-11 01:14:09 +0000 | [diff] [blame] | 35 | UUID_SRCS := $(patsubst %,uuid/%, $(UUID_SRC)) |
| 36 | UUID_OBJS := $(patsubst %.c,%.o, $(UUID_SRCS)) |
| 37 | |
Bernhard Reutner-Fischer | 5d26126 | 2006-03-01 22:54:48 +0000 | [diff] [blame] | 38 | |
Bernhard Reutner-Fischer | 5c071bc | 2005-10-05 07:40:46 +0000 | [diff] [blame] | 39 | # for building out-of-tree we need to make sure that the directories to hold |
| 40 | # the object tree are created |
Bernhard Reutner-Fischer | 5d26126 | 2006-03-01 22:54:48 +0000 | [diff] [blame] | 41 | $(patsubst %,$(objdir)/%, blkid e2fsck e2p ext2fs uuid): |
Bernhard Reutner-Fischer | 7abe709 | 2005-10-05 10:06:11 +0000 | [diff] [blame] | 42 | @mkdir -p "$@" |
Bernhard Reutner-Fischer | 5c071bc | 2005-10-05 07:40:46 +0000 | [diff] [blame] | 43 | |
Bernhard Reutner-Fischer | 7abe709 | 2005-10-05 10:06:11 +0000 | [diff] [blame] | 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). |
Bernhard Reutner-Fischer | 2e9cf37 | 2006-03-06 14:20:43 +0000 | [diff] [blame] | 48 | ifneq ($(MAKE_VERSION),3.81beta4) |
| 49 | # /top/obj/dir/*.o: /top/obj/dir/file.o: /top/src/dir/file.c |
| 50 | $(patsubst %,$(objdir)/%,$(BLKID_OBJS)): $(objdir)/blkid/%.o: $(srcdir)/blkid/%.c |$(objdir)/blkid |
| 51 | $(patsubst %,$(objdir)/%,$(E2FSCK_OBJS)):$(objdir)/e2fsck/%.o:$(srcdir)/e2fsck/%.c|$(objdir)/e2fsck |
| 52 | $(patsubst %,$(objdir)/%,$(E2P_OBJS)): $(objdir)/e2p/%.o: $(srcdir)/e2p/%.c |$(objdir)/e2p |
| 53 | $(patsubst %,$(objdir)/%,$(EXT2FS_OBJS)):$(objdir)/ext2fs/%.o:$(srcdir)/ext2fs/%.c|$(objdir)/ext2fs |
| 54 | $(patsubst %,$(objdir)/%,$(UUID_OBJS)): $(objdir)/uuid/%.o: $(srcdir)/uuid/%.c |$(objdir)/uuid |
| 55 | else |
| 56 | # alleged bug in 3.81beta4. Stripping dir from dir/files.c |
| 57 | # /top/obj/dir/*.o: /top/obj/dir/file.o: /top/src/file.c |
| 58 | $(patsubst %,$(objdir)/%,$(BLKID_OBJS)): $(objdir)/blkid/%.o: $(srcdir)/%.c |$(objdir)/blkid |
Bernhard Reutner-Fischer | 5d26126 | 2006-03-01 22:54:48 +0000 | [diff] [blame] | 59 | $(patsubst %,$(objdir)/%,$(E2FSCK_OBJS)):$(objdir)/e2fsck/%.o:$(srcdir)/%.c|$(objdir)/e2fsck |
Bernhard Reutner-Fischer | 2e9cf37 | 2006-03-06 14:20:43 +0000 | [diff] [blame] | 60 | $(patsubst %,$(objdir)/%,$(E2P_OBJS)): $(objdir)/e2p/%.o: $(srcdir)/%.c |$(objdir)/e2p |
Bernhard Reutner-Fischer | 5d26126 | 2006-03-01 22:54:48 +0000 | [diff] [blame] | 61 | $(patsubst %,$(objdir)/%,$(EXT2FS_OBJS)):$(objdir)/ext2fs/%.o:$(srcdir)/%.c|$(objdir)/ext2fs |
Bernhard Reutner-Fischer | 2e9cf37 | 2006-03-06 14:20:43 +0000 | [diff] [blame] | 62 | $(patsubst %,$(objdir)/%,$(UUID_OBJS)): $(objdir)/uuid/%.o: $(srcdir)/%.c |$(objdir)/uuid |
| 63 | endif |
Bernhard Reutner-Fischer | 5d26126 | 2006-03-01 22:54:48 +0000 | [diff] [blame] | 64 | |
Mike Frysinger | 174808c | 2005-06-11 01:14:09 +0000 | [diff] [blame] | 65 | E2FSPROGS-$(CONFIG_CHATTR) += chattr.o $(E2P_OBJS) |
Mike Frysinger | dc25103 | 2005-10-05 00:52:37 +0000 | [diff] [blame] | 66 | E2FSPROGS-$(CONFIG_E2FSCK) += e2fsck.o util.o $(BLKID_OBJS) $(EXT2FS_OBJS) $(UUID_OBJS) |
"Vladimir N. Oleynik" | d20cfbd | 2005-10-12 16:22:19 +0000 | [diff] [blame] | 67 | E2FSPROGS-$(CONFIG_FSCK) += fsck.o util.o $(BLKID_OBJS) $(UUID_OBJS) |
Mike Frysinger | 174808c | 2005-06-11 01:14:09 +0000 | [diff] [blame] | 68 | E2FSPROGS-$(CONFIG_LSATTR) += lsattr.o $(E2P_OBJS) |
Mike Frysinger | 6447ac0 | 2005-06-11 05:29:40 +0000 | [diff] [blame] | 69 | E2FSPROGS-$(CONFIG_MKE2FS) += mke2fs.o util.o $(E2P_OBJS) $(BLKID_OBJS) $(EXT2FS_OBJS) $(UUID_OBJS) |
Mike Frysinger | 174808c | 2005-06-11 01:14:09 +0000 | [diff] [blame] | 70 | E2FSPROGS-$(CONFIG_TUNE2FS) += tune2fs.o util.o $(E2P_OBJS) $(BLKID_OBJS) $(EXT2FS_OBJS) $(UUID_OBJS) |
Mike Frysinger | d89e5e6 | 2005-04-24 05:15:12 +0000 | [diff] [blame] | 71 | |
Bernhard Reutner-Fischer | 7ca61b6 | 2006-01-15 14:04:57 +0000 | [diff] [blame] | 72 | E2FSPROGS-y:=$(sort $(E2FSPROGS-y)) |
Bernhard Reutner-Fischer | 5d26126 | 2006-03-01 22:54:48 +0000 | [diff] [blame] | 73 | ifneq ($(E2FSPROGS-y),) |
| 74 | CFLAGS-e2fsprogs := -include $(srcdir)/e2fsbb.h |
Rob Landley | d6e14d8 | 2006-02-21 19:11:35 +0000 | [diff] [blame] | 75 | endif |
| 76 | |
Bernhard Reutner-Fischer | 5d26126 | 2006-03-01 22:54:48 +0000 | [diff] [blame] | 77 | E2FSPROGS_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(E2FSPROGS-y)) |
| 78 | E2FSPROGS_SRC-a:=$(wildcard $(srcdir)/*.c) $(patsubst %,$(srcdir)/%,$(BLKID_SRCS) $(E2P_SRCS) $(EXT2FS_SRCS) $(UUID_SRCS)) |
| 79 | APPLET_SRC-y+=$(E2FSPROGS_SRC-y) |
| 80 | APPLET_SRC-a+=$(E2FSPROGS_SRC-a) |
Bernhard Reutner-Fischer | 7ca61b6 | 2006-01-15 14:04:57 +0000 | [diff] [blame] | 81 | |
Bernhard Reutner-Fischer | 5d26126 | 2006-03-01 22:54:48 +0000 | [diff] [blame] | 82 | $(warning FIXME: change .c to include their stuff relative to $(srcdir)) |
| 83 | E2FSPROGS_TMP_KLUDGE:=$(patsubst %,-I$(srcdir)/%,blkid e2fsck e2p ext2fs uuid) |
| 84 | CFLAGS-blkid=$(E2FSPROGS_TMP_KLUDGE) $(CFLAGS-e2fsprogs) |
| 85 | CFLAGS-e2fsck=$(E2FSPROGS_TMP_KLUDGE) $(CFLAGS-e2fsprogs) |
| 86 | CFLAGS-e2p=$(E2FSPROGS_TMP_KLUDGE) $(CFLAGS-e2fsprogs) |
| 87 | CFLAGS-ext2fs=$(E2FSPROGS_TMP_KLUDGE) $(CFLAGS-e2fsprogs) |
| 88 | CFLAGS-uuid=$(E2FSPROGS_TMP_KLUDGE) $(CFLAGS-e2fsprogs) |
Bernhard Reutner-Fischer | 7ca61b6 | 2006-01-15 14:04:57 +0000 | [diff] [blame] | 89 | |
Eric Andersen | 9cc7f32 | 2005-05-11 23:20:09 +0000 | [diff] [blame] | 90 | |
Bernhard Reutner-Fischer | 5d26126 | 2006-03-01 22:54:48 +0000 | [diff] [blame] | 91 | APPLETS_DEFINE-y+=$(CFLAGS-e2fsprogs) -I$(srcdir) $(E2FSPROGS_TMP_KLUDGE) |
| 92 | APPLETS_DEFINE-a+=$(CFLAGS-e2fsprogs) -I$(srcdir) $(E2FSPROGS_TMP_KLUDGE) |
Mike Frysinger | d89e5e6 | 2005-04-24 05:15:12 +0000 | [diff] [blame] | 93 | |
Bernhard Reutner-Fischer | 5d26126 | 2006-03-01 22:54:48 +0000 | [diff] [blame] | 94 | e2fsprogs_OBJ:= $(patsubst %,$(objdir)/%,$(E2FSPROGS-y)) |
| 95 | |