Peter Stuge | 1d862de | 2009-04-14 00:08:34 +0000 | [diff] [blame] | 1 | # |
| 2 | # |
| 3 | # |
| 4 | |
| 5 | obj ?= $(shell pwd) |
| 6 | |
Myles Watson | feaaedc | 2009-04-20 21:38:11 +0000 | [diff] [blame] | 7 | COMMANDS=create.o bootblock.o delete.o extract.o add.o print.o resize.o |
Peter Stuge | 1d862de | 2009-04-14 00:08:34 +0000 | [diff] [blame] | 8 | OBJ=$(COMMANDS) cbfstool.o util.o fs.o |
| 9 | INC=cbfstool.h cbfs.h |
| 10 | |
Stefan Reinauer | 3a5c277 | 2009-05-26 12:22:10 +0000 | [diff] [blame^] | 11 | HOSTCC ?= gcc |
| 12 | HOSTCXX ?= g++ |
| 13 | |
Myles Watson | 475aeda | 2009-05-08 19:39:15 +0000 | [diff] [blame] | 14 | CFLAGS=-g -Wall -W -Werror |
Peter Stuge | 1d862de | 2009-04-14 00:08:34 +0000 | [diff] [blame] | 15 | |
| 16 | DESTDIR ?= /usr/local/bin |
| 17 | |
Peter Stuge | 45ae92ff | 2009-04-14 19:48:32 +0000 | [diff] [blame] | 18 | all: $(obj)/cbfstool $(obj)/tools/cbfs-mkpayload $(obj)/tools/cbfs-mkstage |
Peter Stuge | 1d862de | 2009-04-14 00:08:34 +0000 | [diff] [blame] | 19 | |
| 20 | $(obj)/cbfstool: $(patsubst %,$(obj)/%,$(OBJ)) |
Stefan Reinauer | 3a5c277 | 2009-05-26 12:22:10 +0000 | [diff] [blame^] | 21 | $(HOSTCC) -o $@ $(patsubst %,$(obj)/%,$(OBJ)) |
Peter Stuge | 1d862de | 2009-04-14 00:08:34 +0000 | [diff] [blame] | 22 | |
| 23 | tobj = $(obj)/tools |
| 24 | tsrc = $(shell pwd)/tools |
| 25 | |
| 26 | include $(tsrc)/Makefile |
| 27 | |
| 28 | $(obj)/%.o: %.c $(INC) |
Stefan Reinauer | 3a5c277 | 2009-05-26 12:22:10 +0000 | [diff] [blame^] | 29 | $(HOSTCC) $(CFLAGS) -c -o $@ $< |
Peter Stuge | 1d862de | 2009-04-14 00:08:34 +0000 | [diff] [blame] | 30 | |
Peter Stuge | 45ae92ff | 2009-04-14 19:48:32 +0000 | [diff] [blame] | 31 | install: $(obj)/cbfstool $(obj)/tools/cbfs-mkpayload $(obj)/tools/cbfs-mkstage |
Peter Stuge | 1d862de | 2009-04-14 00:08:34 +0000 | [diff] [blame] | 32 | @ install -d $(DESTDIR) |
| 33 | @ install -m 0755 $(obj)/cbfstool $(DESTDIR)/cbfstool |
Peter Stuge | 45ae92ff | 2009-04-14 19:48:32 +0000 | [diff] [blame] | 34 | @ install -m 0755 $(obj)/tools/cbfs-mkstage $(DESTDIR)/cbfs-mkstage |
| 35 | @ install -m 0755 $(obj)/tools/cbfs-mkpayload $(DESTDIR)/cbfs-mkpayload |
Peter Stuge | 1d862de | 2009-04-14 00:08:34 +0000 | [diff] [blame] | 36 | |
| 37 | tags: |
| 38 | ctags *.[ch] */*.[ch] |
| 39 | |
| 40 | clean: tools-clean |
| 41 | rm -f $(patsubst %,$(obj)/%,$(OBJ)) $(obj)/cbfstool |
| 42 | |