Makefile 763 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 fel
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

Alejandro Mery's avatar
Alejandro Mery committed
24
fexc: 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
30
31
32
33
34
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)

35
36
%: %.c %.h
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(filter %.c,$^) $(LIBS)
37

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