Makefile 701 Bytes
Newer Older
Alejandro Mery's avatar
Alejandro Mery committed
1
CC = gcc
2
3
CFLAGS = -g -O2 -Wall -Wextra
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
9
10
11
12
13

.PHONY: all clean

all: $(TOOLS)

clean:
	@rm -vf $(TOOLS)

14

15
$(TOOLS): Makefile common.h
16

17
18
fex2bin bin2fex: fexc
	ln -s $< $@
19

Alejandro Mery's avatar
Alejandro Mery committed
20
fexc: script.h script.c \
21
22
	script_bin.h script_bin.c \
	script_fex.h script_fex.c
Alejandro Mery's avatar
Alejandro Mery committed
23

24
25
26
27
28
29
30
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)

31
32
%: %.c %.h
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(filter %.c,$^) $(LIBS)
33

Alejandro Mery's avatar
Alejandro Mery committed
34
35
36
37
.gitignore: Makefile
	@for x in $(TOOLS) '*.o' '*.swp'; do \
		echo $$x; \
	done > $@