Makefile 822 Bytes
Newer Older
Alejandro Mery's avatar
Alejandro Mery committed
1
CC = gcc
2
CFLAGS = -g -O0 -Wall -Wextra
3
CFLAGS += -std=c99 -D_POSIX_C_SOURCE=200112L
Alejandro Mery's avatar
Alejandro Mery committed
4

5
TOOLS = fexc bin2fex fex2bin bootinfo fel pio
6
TOOLS += nand-part
Alejandro Mery's avatar
Alejandro Mery committed
7

8
9
MISC_TOOLS = phoenix_info

Alejandro Mery's avatar
Alejandro Mery committed
10
11
12
13
.PHONY: all clean

all: $(TOOLS)

14
15
misc: $(MISC_TOOLS)

Alejandro Mery's avatar
Alejandro Mery committed
16
clean:
17
	@rm -vf $(TOOLS) $(MISC_TOOLS)
Alejandro Mery's avatar
Alejandro Mery committed
18

19

20
$(TOOLS): Makefile common.h
21

22
23
fex2bin bin2fex: fexc
	ln -s $< $@
24

25
fexc: fexc.h script.h script.c \
26
27
	script_bin.h script_bin.c \
	script_fex.h script_fex.c
Alejandro Mery's avatar
Alejandro Mery committed
28

29
30
bootinfo: bootinfo.c

31
32
33
34
35
36
37
LIBUSB = libusb-1.0
LIBUSB_CFLAGS = `pkg-config --cflags $(LIBUSB)`
LIBUSB_LIBS = `pkg-config --libs $(LIBUSB)`

fel: fel.c
	$(CC) $(CFLAGS) $(LIBUSB_CFLAGS) $(LDFLAGS) -o $@ $(filter %.c,$^) $(LIBS) $(LIBUSB_LIBS)

38
%: %.c
39
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(filter %.c,$^) $(LIBS)
40

Alejandro Mery's avatar
Alejandro Mery committed
41
42
.gitignore: Makefile
	@for x in $(TOOLS) '*.o' '*.swp'; do \
Alejandro Mery's avatar
Alejandro Mery committed
43
		echo "$$x"; \
Alejandro Mery's avatar
Alejandro Mery committed
44
	done > $@