diff options
Diffstat (limited to 'rbutil/mktccboot/Makefile')
-rw-r--r-- | rbutil/mktccboot/Makefile | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/rbutil/mktccboot/Makefile b/rbutil/mktccboot/Makefile index 7a7acf87b7..b01f25dc3d 100644 --- a/rbutil/mktccboot/Makefile +++ b/rbutil/mktccboot/Makefile | |||
@@ -34,29 +34,34 @@ ifdef RBARCH | |||
34 | CFLAGS += -arch $(RBARCH) | 34 | CFLAGS += -arch $(RBARCH) |
35 | endif | 35 | endif |
36 | 36 | ||
37 | OUT = $(TARGET_DIR)build$(RBARCH) | 37 | TARGET_DIR ?= $(shell pwd)/ |
38 | OBJDIR = $(TARGET_DIR)build$(RBARCH) | ||
38 | 39 | ||
39 | all: $(OUTPUT) | 40 | all: $(OUTPUT) |
40 | 41 | ||
41 | # inputs | 42 | # inputs |
42 | LIBSOURCES := mktccboot.c $(TOOLSDIR)/telechips.o | 43 | LIBSOURCES := mktccboot.c $(TOOLSDIR)/telechips.o |
43 | SOURCES := $(LIBSOURCES) main.c | 44 | SOURCES := $(LIBSOURCES) main.c |
44 | OBJS := $(patsubst %.c,%.o,$(addprefix $(OUT)/,$(notdir $(SOURCES)))) | 45 | OBJS := $(patsubst %.c,%.o,$(addprefix $(OBJDIR)/,$(notdir $(SOURCES)))) |
45 | LIBOBJS := $(patsubst %.c,%.o,$(addprefix $(OUT)/,$(notdir $(LIBSOURCES)))) | 46 | LIBOBJS := $(patsubst %.c,%.o,$(addprefix $(OBJDIR)/,$(notdir $(LIBSOURCES)))) |
46 | EXTRADEPS := | 47 | EXTRADEPS := |
47 | 48 | ||
48 | # rule for sources from tools dir | 49 | # rule for sources from tools dir |
49 | $(OUT)/%.o: $(TOOLSDIR)/%.c $(OUT) | 50 | $(OBJDIR)/%.o: $(TOOLSDIR)/%.c |
50 | @echo CC $< | 51 | @echo CC $< |
52 | $(SILENT)mkdir -p $(dir $@) | ||
51 | $(SILENT)$(CC) $(CFLAGS) -c -o $@ $< | 53 | $(SILENT)$(CC) $(CFLAGS) -c -o $@ $< |
52 | 54 | ||
53 | $(OUT)/%.o: %.c $(OUT) | 55 | $(OBJDIR)/%.o: %.c |
54 | @echo CC $< | 56 | @echo CC $< |
57 | $(SILENT)mkdir -p $(dir $@) | ||
55 | $(SILENT)$(CC) $(CFLAGS) -c -o $@ $< | 58 | $(SILENT)$(CC) $(CFLAGS) -c -o $@ $< |
56 | 59 | ||
57 | libmktccboot$(RBARCH).a: $(LIBOBJS) | 60 | libmktccboot$(RBARCH).a: $(TARGET_DIR)libmktccboot$(RBARCH).a |
58 | @echo AR $@ | 61 | |
59 | $(SILENT)$(AR) rucs $(TARGET_DIR)$@ $^ | 62 | $(TARGET_DIR)libmktccboot$(RBARCH).a: $(LIBOBJS) |
63 | @echo AR $(notdir $@) | ||
64 | $(SILENT)$(AR) rucs $@ $^ | ||
60 | 65 | ||
61 | # building the standalone executable | 66 | # building the standalone executable |
62 | $(OUTPUT): $(OBJS) $(EXTRADEPS) | 67 | $(OUTPUT): $(OBJS) $(EXTRADEPS) |
@@ -70,16 +75,16 @@ $(TARGET_DIR)libmktccbooti386.a: | |||
70 | 75 | ||
71 | $(TARGET_DIR)libmktccbootppc.a: | 76 | $(TARGET_DIR)libmktccbootppc.a: |
72 | make RBARCH=ppc TARGET_DIR=$(TARGET_DIR) libmktccbootppc.a | 77 | make RBARCH=ppc TARGET_DIR=$(TARGET_DIR) libmktccbootppc.a |
73 | endif | 78 | endif |
74 | 79 | ||
75 | libmktccboot-universal: $(TARGET_DIR)libmktccbooti386.a $(TARGET_DIR)libmktccbootppc.a | 80 | libmktccboot-universal: $(TARGET_DIR)libmktccbooti386.a $(TARGET_DIR)libmktccbootppc.a |
76 | @echo lipo $(TARGET_DIR)libmktccboot.a | 81 | @echo lipo $(TARGET_DIR)libmktccboot.a |
77 | $(SILENT) rm -f $(TARGET_DIR)libmktccboot.a | 82 | $(SILENT) rm -f $(TARGET_DIR)libmktccboot.a |
78 | $(SILENT)lipo -create $(TARGET_DIR)libmktccbootppc.a $(TARGET_DIR)libmktccbooti386.a -output $(TARGET_DIR)libmktccboot.a | 83 | $(SILENT)lipo -create $(TARGET_DIR)libmktccbootppc.a $(TARGET_DIR)libmktccbooti386.a -output $(TARGET_DIR)libmktccboot.a |
79 | 84 | ||
80 | clean: | 85 | clean: |
81 | rm -f $(OUTPUT) $(TARGET_DIR)libmktccboot*.a mktccboot.dmg | 86 | rm -f $(OUTPUT) $(TARGET_DIR)libmktccboot*.a mktccboot.dmg |
82 | rm -rf $(OUT) | 87 | rm -rf $(OBJDIR) |
83 | 88 | ||
84 | mktccboot-i386: | 89 | mktccboot-i386: |
85 | $(MAKE) RBARCH=i386 | 90 | $(MAKE) RBARCH=i386 |
@@ -96,8 +101,5 @@ mktccboot.dmg: mktccboot-mac | |||
96 | mkdir -p mktccboot-dmg | 101 | mkdir -p mktccboot-dmg |
97 | cp -p mktccboot-mac mktccboot-dmg | 102 | cp -p mktccboot-mac mktccboot-dmg |
98 | hdiutil create -srcfolder mktccboot-dmg mktccboot.dmg | 103 | hdiutil create -srcfolder mktccboot-dmg mktccboot.dmg |
99 | 104 | ||
100 | $(OUT): | ||
101 | @echo MKDIR $(OUT) | ||
102 | $(SILENT)mkdir $(OUT) | ||
103 | 105 | ||