Makefile 843 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
4
CFLAGS += -Iinclude/
Alejandro Mery's avatar
Alejandro Mery committed
5

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

9
10
MISC_TOOLS = phoenix_info

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

all: $(TOOLS)

15
16
misc: $(MISC_TOOLS)

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

20

21
$(TOOLS): Makefile common.h
22

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

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

30
31
bootinfo: bootinfo.c

32
33
34
35
36
37
38
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)

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

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