aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 52da294c709cf6226c826760124e960af47b2057 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
MAIN = plugin-img

GIMPTOOL = gimptool-2.0
GIMP = gimp
GIMPCONSOLE = gimp-console
CC = cc
LD = cc
CFLAGS = -O2 -Wall -Wextra

SRC = img-load.c img-save.c img-save-dialog.c plugin-img.c
HDR = $(SRC:.c=.h)
OBJ = $(SRC:.c=.o)

$(MAIN): $(OBJ)
	$(LD) $(OBJ) `$(GIMPTOOL) --libs` -o $@

$(OBJ): $(HDR) Makefile

.c.o:
	$(CC) `$(GIMPTOOL) --cflags` $(CFLAGS) -c $< -o $@

.PHONY: view
view: install
	$(GIMP) samples/*.img

.PHONY: test
test: test.scm install
	rm -f samples/success
	$(GIMPCONSOLE) --no-interface --batch - < $<
	test -f samples/success

.PHONY: install
install: $(MAIN)
	$(GIMPTOOL) --install-bin $(MAIN)

.PHONY: uninstall
uninstall:
	$(GIMPTOOL) --uninstall-bin $(MAIN)

.PHONY: clean
clean:
	rm -f *.o *.i *.s $(MAIN)
	rm -f samples/recoded-*
	rm -f samples/success