Makefile 803 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
Alejandro Mery's avatar
Alejandro Mery committed
6

7
8
MISC_TOOLS = phoenix_info

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

all: $(TOOLS)

13
14
misc: $(MISC_TOOLS)

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

18

19
$(TOOLS): Makefile common.h
20

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

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

28
29
bootinfo: bootinfo.c

30
31
32
33
34
35
36
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)

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

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