diff options
| author | Eric Andersen <andersen@codepoet.org> | 2001-10-24 05:26:42 +0000 |
|---|---|---|
| committer | Eric Andersen <andersen@codepoet.org> | 2001-10-24 05:26:42 +0000 |
| commit | 4bcdd7214217bfdaa2c4015425d439686d5b8b0b (patch) | |
| tree | 667d387f80c5b5c69ab8b24044614f999f00668a | |
| parent | bdfd0d78bc44e73d693510e70087857785b3b521 (diff) | |
| download | busybox-w32-4bcdd7214217bfdaa2c4015425d439686d5b8b0b.tar.gz busybox-w32-4bcdd7214217bfdaa2c4015425d439686d5b8b0b.tar.bz2 busybox-w32-4bcdd7214217bfdaa2c4015425d439686d5b8b0b.zip | |
Oops. Forgot these....
| -rw-r--r-- | Rules.mak | 195 | ||||
| -rw-r--r-- | applets/Makefile | 35 |
2 files changed, 230 insertions, 0 deletions
diff --git a/Rules.mak b/Rules.mak new file mode 100644 index 000000000..a6f111695 --- /dev/null +++ b/Rules.mak | |||
| @@ -0,0 +1,195 @@ | |||
| 1 | # | ||
| 2 | # This file contains rules which are shared between multiple Makefiles. | ||
| 3 | # | ||
| 4 | |||
| 5 | # | ||
| 6 | # False targets. | ||
| 7 | # | ||
| 8 | .PHONY: dummy | ||
| 9 | |||
| 10 | # | ||
| 11 | # Special variables which should not be exported | ||
| 12 | # | ||
| 13 | unexport EXTRA_AFLAGS | ||
| 14 | unexport EXTRA_CFLAGS | ||
| 15 | unexport EXTRA_LDFLAGS | ||
| 16 | unexport EXTRA_ARFLAGS | ||
| 17 | unexport SUBDIRS | ||
| 18 | unexport SUB_DIRS | ||
| 19 | unexport ALL_SUB_DIRS | ||
| 20 | unexport O_TARGET | ||
| 21 | |||
| 22 | unexport obj-y | ||
| 23 | unexport obj-n | ||
| 24 | unexport obj- | ||
| 25 | unexport export-objs | ||
| 26 | unexport subdir-y | ||
| 27 | unexport subdir-n | ||
| 28 | unexport subdir- | ||
| 29 | |||
| 30 | # | ||
| 31 | # Get things started. | ||
| 32 | # | ||
| 33 | first_rule: sub_dirs | ||
| 34 | $(MAKE) all_targets | ||
| 35 | |||
| 36 | SUB_DIRS := $(subdir-y) | ||
| 37 | ALL_SUB_DIRS := $(sort $(subdir-y) $(subdir-n) $(subdir-)) | ||
| 38 | |||
| 39 | |||
| 40 | # | ||
| 41 | # Common rules | ||
| 42 | # | ||
| 43 | |||
| 44 | %.s: %.c | ||
| 45 | $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) -S $< -o $@ | ||
| 46 | |||
| 47 | %.i: %.c | ||
| 48 | $(CPP) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) $< > $@ | ||
| 49 | |||
| 50 | %.o: %.c | ||
| 51 | $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) -c -o $@ $< | ||
| 52 | @ ( \ | ||
| 53 | echo 'ifeq ($(strip $(subst $(comma),:,$(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@))),$$(strip $$(subst $$(comma),:,$$(CFLAGS) $$(EXTRA_CFLAGS) $$(CFLAGS_$@))))' ; \ | ||
| 54 | echo 'FILES_FLAGS_UP_TO_DATE += $@' ; \ | ||
| 55 | echo 'endif' \ | ||
| 56 | ) > $(dir $@)/.$(notdir $@).flags | ||
| 57 | |||
| 58 | %.o: %.s | ||
| 59 | $(AS) $(AFLAGS) $(EXTRA_CFLAGS) -o $@ $< | ||
| 60 | |||
| 61 | # Old makefiles define their own rules for compiling .S files, | ||
| 62 | # but these standard rules are available for any Makefile that | ||
| 63 | # wants to use them. Our plan is to incrementally convert all | ||
| 64 | # the Makefiles to these standard rules. -- rmk, mec | ||
| 65 | ifdef USE_STANDARD_AS_RULE | ||
| 66 | |||
| 67 | %.s: %.S | ||
| 68 | $(CPP) $(AFLAGS) $(EXTRA_AFLAGS) $(AFLAGS_$@) $< > $@ | ||
| 69 | |||
| 70 | %.o: %.S | ||
| 71 | $(CC) $(AFLAGS) $(EXTRA_AFLAGS) $(AFLAGS_$@) -c -o $@ $< | ||
| 72 | |||
| 73 | endif | ||
| 74 | |||
| 75 | %.lst: %.c | ||
| 76 | $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) -g -c -o $*.o $< | ||
| 77 | $(TOPDIR)/scripts/makelst $* $(TOPDIR) $(OBJDUMP) | ||
| 78 | # | ||
| 79 | # | ||
| 80 | # | ||
| 81 | all_targets: $(O_TARGET) $(L_TARGET) | ||
| 82 | |||
| 83 | # | ||
| 84 | # Rule to compile a set of .o files into one .o file | ||
| 85 | # | ||
| 86 | ifdef O_TARGET | ||
| 87 | $(O_TARGET): $(obj-y) | ||
| 88 | rm -f $@ | ||
| 89 | ifneq "$(strip $(obj-y))" "" | ||
| 90 | $(LD) $(EXTRA_LDFLAGS) -r -o $@ $(filter $(obj-y), $^) | ||
| 91 | else | ||
| 92 | $(AR) rcs $@ | ||
| 93 | endif | ||
| 94 | @ ( \ | ||
| 95 | echo 'ifeq ($(strip $(subst $(comma),:,$(EXTRA_LDFLAGS) $(obj-y))),$$(strip $$(subst $$(comma),:,$$(EXTRA_LDFLAGS) $$(obj-y))))' ; \ | ||
| 96 | echo 'FILES_FLAGS_UP_TO_DATE += $@' ; \ | ||
| 97 | echo 'endif' \ | ||
| 98 | ) > $(dir $@)/.$(notdir $@).flags | ||
| 99 | endif # O_TARGET | ||
| 100 | |||
| 101 | # | ||
| 102 | # Rule to compile a set of .o files into one .a file | ||
| 103 | # | ||
| 104 | ifdef L_TARGET | ||
| 105 | $(L_TARGET): $(obj-y) | ||
| 106 | rm -f $@ | ||
| 107 | $(AR) $(EXTRA_ARFLAGS) rcs $@ $(obj-y) | ||
| 108 | @ ( \ | ||
| 109 | echo 'ifeq ($(strip $(subst $(comma),:,$(EXTRA_ARFLAGS) $(obj-y))),$$(strip $$(subst $$(comma),:,$$(EXTRA_ARFLAGS) $$(obj-y))))' ; \ | ||
| 110 | echo 'FILES_FLAGS_UP_TO_DATE += $@' ; \ | ||
| 111 | echo 'endif' \ | ||
| 112 | ) > $(dir $@)/.$(notdir $@).flags | ||
| 113 | endif | ||
| 114 | |||
| 115 | |||
| 116 | # | ||
| 117 | # This make dependencies quickly | ||
| 118 | # | ||
| 119 | fastdep: dummy | ||
| 120 | $(TOPDIR)/scripts/mkdep $(CFLAGS) $(EXTRA_CFLAGS) -- $(wildcard *.[chS]) > .depend | ||
| 121 | ifdef ALL_SUB_DIRS | ||
| 122 | $(MAKE) $(patsubst %,_sfdep_%,$(ALL_SUB_DIRS)) _FASTDEP_ALL_SUB_DIRS="$(ALL_SUB_DIRS)" | ||
| 123 | endif | ||
| 124 | |||
| 125 | ifdef _FASTDEP_ALL_SUB_DIRS | ||
| 126 | $(patsubst %,_sfdep_%,$(_FASTDEP_ALL_SUB_DIRS)): | ||
| 127 | $(MAKE) -C $(patsubst _sfdep_%,%,$@) fastdep | ||
| 128 | endif | ||
| 129 | |||
| 130 | |||
| 131 | # | ||
| 132 | # A rule to make subdirectories | ||
| 133 | # | ||
| 134 | subdir-list = $(sort $(patsubst %,_subdir_%,$(SUB_DIRS))) | ||
| 135 | sub_dirs: dummy $(subdir-list) | ||
| 136 | |||
| 137 | ifdef SUB_DIRS | ||
| 138 | $(subdir-list) : dummy | ||
| 139 | $(MAKE) -C $(patsubst _subdir_%,%,$@) | ||
| 140 | endif | ||
| 141 | |||
| 142 | # | ||
| 143 | # A rule to do nothing | ||
| 144 | # | ||
| 145 | dummy: | ||
| 146 | |||
| 147 | # | ||
| 148 | # This is useful for testing | ||
| 149 | # | ||
| 150 | script: | ||
| 151 | $(SCRIPT) | ||
| 152 | |||
| 153 | # | ||
| 154 | # include dependency files if they exist | ||
| 155 | # | ||
| 156 | ifneq ($(wildcard .depend),) | ||
| 157 | include .depend | ||
| 158 | endif | ||
| 159 | |||
| 160 | ifneq ($(wildcard $(TOPDIR)/.hdepend),) | ||
| 161 | include $(TOPDIR)/.hdepend | ||
| 162 | endif | ||
| 163 | |||
| 164 | # | ||
| 165 | # Find files whose flags have changed and force recompilation. | ||
| 166 | # For safety, this works in the converse direction: | ||
| 167 | # every file is forced, except those whose flags are positively up-to-date. | ||
| 168 | # | ||
| 169 | FILES_FLAGS_UP_TO_DATE := | ||
| 170 | |||
| 171 | # For use in expunging commas from flags, which mung our checking. | ||
| 172 | comma = , | ||
| 173 | |||
| 174 | FILES_FLAGS_EXIST := $(wildcard .*.flags) | ||
| 175 | ifneq ($(FILES_FLAGS_EXIST),) | ||
| 176 | include $(FILES_FLAGS_EXIST) | ||
| 177 | endif | ||
| 178 | |||
| 179 | FILES_FLAGS_CHANGED := $(strip \ | ||
| 180 | $(filter-out $(FILES_FLAGS_UP_TO_DATE), \ | ||
| 181 | $(O_TARGET) $(L_TARGET) $(active-objs) \ | ||
| 182 | )) | ||
| 183 | |||
| 184 | # A kludge: .S files don't get flag dependencies (yet), | ||
| 185 | # because that will involve changing a lot of Makefiles. Also | ||
| 186 | # suppress object files explicitly listed in $(IGNORE_FLAGS_OBJS). | ||
| 187 | # This allows handling of assembly files that get translated into | ||
| 188 | # multiple object files (see arch/ia64/lib/idiv.S, for example). | ||
| 189 | FILES_FLAGS_CHANGED := $(strip \ | ||
| 190 | $(filter-out $(patsubst %.S, %.o, $(wildcard *.S) $(IGNORE_FLAGS_OBJS)), \ | ||
| 191 | $(FILES_FLAGS_CHANGED))) | ||
| 192 | |||
| 193 | ifneq ($(FILES_FLAGS_CHANGED),) | ||
| 194 | $(FILES_FLAGS_CHANGED): dummy | ||
| 195 | endif | ||
diff --git a/applets/Makefile b/applets/Makefile new file mode 100644 index 000000000..0688a8f3d --- /dev/null +++ b/applets/Makefile | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | # Makefile for busybox | ||
| 2 | # | ||
| 3 | # Copyright (C) 1999,2000,2001 by Erik Andersen <andersee@debian.org> | ||
| 4 | # | ||
| 5 | # This program is free software; you can redistribute it and/or modify | ||
| 6 | # it under the terms of the GNU General Public License as published by | ||
| 7 | # the Free Software Foundation; either version 2 of the License, or | ||
| 8 | # (at your option) any later version. | ||
| 9 | # | ||
| 10 | # This program is distributed in the hope that it will be useful, | ||
| 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 13 | # General Public License for more details. | ||
| 14 | # | ||
| 15 | # You should have received a copy of the GNU General Public License | ||
| 16 | # along with this program; if not, write to the Free Software | ||
| 17 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 18 | # | ||
| 19 | |||
| 20 | TOPDIR :=.. | ||
| 21 | L_TARGET := applets.a | ||
| 22 | EXTRA_CFLAGS+=-I $(TOPDIR)/applets | ||
| 23 | |||
| 24 | obj-y := | ||
| 25 | obj-n := | ||
| 26 | obj- := | ||
| 27 | |||
| 28 | obj-y += applets.o busybox.o usage.o | ||
| 29 | |||
| 30 | # Hand off to toplevel Rules.mak | ||
| 31 | include $(TOPDIR)/Rules.mak | ||
| 32 | |||
| 33 | clean: | ||
| 34 | rm -f $(L_TARGET) *.o core | ||
| 35 | |||
