summaryrefslogtreecommitdiff
path: root/util/romtool/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'util/romtool/Makefile')
-rw-r--r--util/romtool/Makefile39
1 files changed, 25 insertions, 14 deletions
diff --git a/util/romtool/Makefile b/util/romtool/Makefile
index 44982674f3..3b2e3a56dc 100644
--- a/util/romtool/Makefile
+++ b/util/romtool/Makefile
@@ -1,27 +1,38 @@
+#
+#
+#
+
+obj ?= $(shell pwd)
+
COMMANDS=create.o bootblock.o delete.o add.o print.o resize.o
-OBJ= $(COMMANDS) romtool.o util.o fs.o
+OBJ=$(COMMANDS) romtool.o util.o fs.o
+
+CC=gcc
+CFLAGS=-g -Wall -W #-Werror
+
H=romtool.h
-DESTDIR=/usr/local/bin
+DESTDIR ?= /usr/local/bin
-all: romtool tools/rom-mkpayload tools/rom-mkstage
+all: $(obj)/romtool $(obj)/tools/rom-mkpayload $(obj)/tools/rom-mkstage
-romtool: $(OBJ)
- $(CC) -o $@ $(OBJ)
+$(obj)/romtool: $(patsubst %,$(obj)/%,$(OBJ))
+ $(CC) -o $@ $(patsubst %,$(obj)/%,$(OBJ))
-tools/rom-mkpayload tools/rom-mkstage:
- $(MAKE) -C tools/ $(patsubst tools/%, %, $@)
+$(obj)/tools/rom-mkpayload $(obj)/tools/rom-mkstage:
+ $(MAKE) -C tools/ obj=$(obj)/tools $(patsubst tools/%, %, $@)
-%.o: %.c
- $(CC) -g -Wall -Werror -c -o $@ $<
+$(obj)/%.o: %.c
+ $(CC) $(CFLAGS) -c -o $@ $<
-install: romtool tools/rom-mkpayload tools/rom-mkstage
+install: $(obj)/romtool $(obj)/tools/rom-mkpayload $(obj)/tools/rom-mkstage
@ install -d $(DESTDIR)
- @ install -m 0755 romtool $(DESTDIR)/romtool
- @ install -m 0755 tools/rom-mkstage $(DESTDIR)/rom-mkstage
- @ install -m 0755 tools/rom-mkpayload $(DESTDIR)/rom-mkpayload
+ @ install -m 0755 $(obj)/romtool $(DESTDIR)/romtool
+ @ install -m 0755 $(obj)/tools/rom-mkstage $(DESTDIR)/rom-mkstage
+ @ install -m 0755 $(obj)/tools/rom-mkpayload $(DESTDIR)/rom-mkpayload
tags:
ctags *.[ch] */*.[ch]
+
clean:
$(MAKE) -C tools/ clean
- rm -f *.o romtool
+ rm -f $(patsubst %,$(obj)/%,$(OBJ)) $(obj)/romtool