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 | |
| 7 | E2FSPROGS_AR:=e2fsprogs.a |
Rob Landley | e1d9633 | 2005-08-24 00:41:52 +0000 | [diff] [blame] | 8 | |
Mike Frysinger | 51a43b4 | 2005-09-24 07:11:16 +0000 | [diff] [blame] | 9 | E2FSPROGS_DIR:=$(top_builddir)/e2fsprogs |
Bernhard Reutner-Fischer | 7abe709 | 2005-10-05 10:06:11 +0000 | [diff] [blame] | 10 | E2FSPROGS_SRC:=$(top_srcdir)/e2fsprogs |
Rob Landley | e1d9633 | 2005-08-24 00:41:52 +0000 | [diff] [blame] | 11 | |
"Vladimir N. Oleynik" | 083d3f4 | 2005-10-10 11:35:17 +0000 | [diff] [blame] | 12 | E2FSPROGS_CFLAGS := -include $(E2FSPROGS_SRC)/e2fsbb.h |
Eric Andersen | 9cc7f32 | 2005-05-11 23:20:09 +0000 | [diff] [blame] | 13 | |
"Vladimir N. Oleynik" | b71e602 | 2005-09-19 13:48:39 +0000 | [diff] [blame] | 14 | 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] | 15 | probe.c read.c resolve.c save.c tag.c |
Mike Frysinger | 174808c | 2005-06-11 01:14:09 +0000 | [diff] [blame] | 16 | BLKID_SRCS := $(patsubst %,blkid/%, $(BLKID_SRC)) |
| 17 | BLKID_OBJS := $(patsubst %.c,%.o, $(BLKID_SRCS)) |
| 18 | |
| 19 | 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] | 20 | feature.c ls.c uuid.c pe.c ostype.c ps.c hashstr.c \ |
| 21 | parse_num.c |
Mike Frysinger | f3d2884 | 2005-06-11 00:27:50 +0000 | [diff] [blame] | 22 | E2P_SRCS := $(patsubst %,e2p/%, $(E2P_SRC)) |
| 23 | E2P_OBJS := $(patsubst %.c,%.o, $(E2P_SRCS)) |
Eric Andersen | 9cc7f32 | 2005-05-11 23:20:09 +0000 | [diff] [blame] | 24 | |
Mike Frysinger | 174808c | 2005-06-11 01:14:09 +0000 | [diff] [blame] | 25 | 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] | 26 | rw_bitmaps.c initialize.c bitmaps.c block.c \ |
| 27 | ind_block.c inode.c freefs.c alloc_stats.c closefs.c \ |
| 28 | openfs.c io_manager.c finddev.c read_bb.c alloc.c badblocks.c \ |
| 29 | getsize.c getsectsize.c alloc_tables.c read_bb_file.c mkdir.c \ |
| 30 | bb_inode.c newdir.c alloc_sb.c lookup.c dirblock.c expanddir.c \ |
| 31 | dir_iterate.c link.c res_gdt.c icount.c get_pathname.c dblist.c \ |
| 32 | 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] | 33 | 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] | 34 | EXT2FS_SRCS := $(patsubst %,ext2fs/%, $(EXT2FS_SRC)) |
| 35 | EXT2FS_OBJS := $(patsubst %.c,%.o, $(EXT2FS_SRCS)) |
| 36 | |
| 37 | 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] | 38 | uuid_time.c |
Mike Frysinger | 174808c | 2005-06-11 01:14:09 +0000 | [diff] [blame] | 39 | UUID_SRCS := $(patsubst %,uuid/%, $(UUID_SRC)) |
| 40 | UUID_OBJS := $(patsubst %.c,%.o, $(UUID_SRCS)) |
| 41 | |
Bernhard Reutner-Fischer | 5c071bc | 2005-10-05 07:40:46 +0000 | [diff] [blame] | 42 | # for building out-of-tree we need to make sure that the directories to hold |
| 43 | # the object tree are created |
| 44 | $(patsubst %,$(E2FSPROGS_DIR)/%, blkid e2fsck e2p ext2fs uuid): |
Bernhard Reutner-Fischer | 7abe709 | 2005-10-05 10:06:11 +0000 | [diff] [blame] | 45 | @mkdir -p "$@" |
Bernhard Reutner-Fischer | 5c071bc | 2005-10-05 07:40:46 +0000 | [diff] [blame] | 46 | |
Bernhard Reutner-Fischer | 7abe709 | 2005-10-05 10:06:11 +0000 | [diff] [blame] | 47 | # make sure that the directories are order-only prerequisites. Otherwise we |
| 48 | # may have object files created after the timestamp of the directory was |
| 49 | # updated which would lead to spurious rebuilds (as some of the dentries |
| 50 | # may be older than the dir itself). |
| 51 | $(patsubst %,$(E2FSPROGS_DIR)/%, $(BLKID_OBJS)):|$(E2FSPROGS_DIR)/blkid |
| 52 | $(patsubst %,$(E2FSPROGS_DIR)/%, $(E2FSCK_OBJS)):|$(E2FSPROGS_DIR)/e2fsck |
| 53 | $(patsubst %,$(E2FSPROGS_DIR)/%, $(E2P_OBJS)):|$(E2FSPROGS_DIR)/e2p |
| 54 | $(patsubst %,$(E2FSPROGS_DIR)/%, $(EXT2FS_OBJS)):|$(E2FSPROGS_DIR)/ext2fs |
| 55 | $(patsubst %,$(E2FSPROGS_DIR)/%, $(UUID_OBJS)):|$(E2FSPROGS_DIR)/uuid |
Bernhard Reutner-Fischer | 5c071bc | 2005-10-05 07:40:46 +0000 | [diff] [blame] | 56 | |
| 57 | E2FSPROGS-y:= |
Mike Frysinger | 174808c | 2005-06-11 01:14:09 +0000 | [diff] [blame] | 58 | E2FSPROGS-$(CONFIG_CHATTR) += chattr.o $(E2P_OBJS) |
Mike Frysinger | dc25103 | 2005-10-05 00:52:37 +0000 | [diff] [blame] | 59 | 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] | 60 | E2FSPROGS-$(CONFIG_FSCK) += fsck.o util.o $(BLKID_OBJS) $(UUID_OBJS) |
Mike Frysinger | 174808c | 2005-06-11 01:14:09 +0000 | [diff] [blame] | 61 | E2FSPROGS-$(CONFIG_LSATTR) += lsattr.o $(E2P_OBJS) |
Mike Frysinger | 6447ac0 | 2005-06-11 05:29:40 +0000 | [diff] [blame] | 62 | 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] | 63 | 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] | 64 | |
Bernhard Reutner-Fischer | 7ca61b6 | 2006-01-15 14:04:57 +0000 | [diff] [blame] | 65 | E2FSPROGS-y:=$(sort $(E2FSPROGS-y)) |
Mike Frysinger | d89e5e6 | 2005-04-24 05:15:12 +0000 | [diff] [blame] | 66 | |
Rob Landley | d6e14d8 | 2006-02-21 19:11:35 +0000 | [diff] [blame] | 67 | ifneq ($(strip $(E2FSPROGS-y)),) |
Bernhard Reutner-Fischer | 7ca61b6 | 2006-01-15 14:04:57 +0000 | [diff] [blame] | 68 | libraries-y+=$(E2FSPROGS_DIR)/$(E2FSPROGS_AR) |
Rob Landley | d6e14d8 | 2006-02-21 19:11:35 +0000 | [diff] [blame] | 69 | endif |
| 70 | |
Bernhard Reutner-Fischer | 7ca61b6 | 2006-01-15 14:04:57 +0000 | [diff] [blame] | 71 | E2FSPROGS_SRC-y:=$(patsubst %.o,$(E2FSPROGS_SRC)/%.c,$(E2FSPROGS-y)) |
| 72 | E2FSPROGS_SRC-a:=$(wildcard $(E2FSPROGS_SRC)/*.c) $(patsubst %,$(E2FSPROGS_SRC)/%,$(BLKID_SRCS) $(E2P_SRCS) $(EXT2FS_SRCS) $(UUID_SRCS)) |
| 73 | APPLET_SRC-y+=$(E2FSPROGS_CFLAGS) $(E2FSPROGS_SRC-y) |
| 74 | APPLET_SRC-a+=$(E2FSPROGS_CFLAGS) $(E2FSPROGS_SRC-a) |
| 75 | |
| 76 | # XXX: FIXME: change .c to include their stuff relative to $(E2FSPROGS_SRC) |
| 77 | E2FSPROGS_TMP_KLUDGE:=$(patsubst %,-I$(E2FSPROGS_SRC)/%,blkid e2fsck e2p ext2fs uuid) |
| 78 | |
| 79 | APPLETS_DEFINE-y+=$(E2FSPROGS_CFLAGS) -I$(E2FSPROGS_SRC) $(E2FSPROGS_TMP_KLUDGE) |
| 80 | APPLETS_DEFINE-a+=$(E2FSPROGS_CFLAGS) -I$(E2FSPROGS_SRC) $(E2FSPROGS_TMP_KLUDGE) |
Eric Andersen | 9cc7f32 | 2005-05-11 23:20:09 +0000 | [diff] [blame] | 81 | |
Mike Frysinger | 51a43b4 | 2005-09-24 07:11:16 +0000 | [diff] [blame] | 82 | $(E2FSPROGS_DIR)/$(E2FSPROGS_AR): $(patsubst %,$(E2FSPROGS_DIR)/%, $(E2FSPROGS-y)) |
Mike Frysinger | b38673f | 2006-02-02 01:41:53 +0000 | [diff] [blame] | 83 | $(do_ar) |
Mike Frysinger | d89e5e6 | 2005-04-24 05:15:12 +0000 | [diff] [blame] | 84 | |
Bernhard Reutner-Fischer | 5c071bc | 2005-10-05 07:40:46 +0000 | [diff] [blame] | 85 | $(E2FSPROGS_DIR)/%.o: $(subst $(top_builddir),$(top_srcdir),$(E2FSPROGS_DIR)/%.c) |
Mike Frysinger | b38673f | 2006-02-02 01:41:53 +0000 | [diff] [blame] | 86 | $(compile.c) $(E2FSPROGS_CFLAGS) |