1# Copyright (C) 2012 hejian <hejian.he@gmail.com>
2#
3# This program is free software: you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by
5# the Free Software Foundation; either version 3 of the License, or
6# (at your option) any later version.
7#
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11# GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License
14# along with this program.  If not, see <http://www.gnu.org/licenses/>.
15
16
17GIMPTOOL = /usr/local/bin/gimptool-2.0
18
19GIMP_LIBS = `$(GIMPTOOL) --libs`
20GIMP_CFLAGS = `$(GIMPTOOL) --cflags`
21
22LIBS = $(GIMP_LIBS) -lm
23CFLAGS += $(GIMP_CFLAGS)
24
25GDK_PIXBUF_CSOURCE = /usr/local/bin/gdk-pixbuf-csource
26
27all: beautify skin-whitening simple-border border
28
29install: beautify skin-whitening simple-border border
30	# need fix: --install-admin-bin has issue in x86_64,
31	# it install the plug-in into /usr/lib/gimp/2.0/plug-ins/
32	# but the correct directory is /usr/lib64/gimp/2.0/plug-ins/
33	$(GIMPTOOL) --install-admin-bin beautify
34	$(GIMPTOOL) --install-admin-bin skin-whitening
35	$(GIMPTOOL) --install-admin-bin simple-border
36	$(GIMPTOOL) --install-admin-bin border
37	ln -sf /usr/lib/gimp/2.0/plug-ins/beautify /usr/lib64/gimp/2.0/plug-ins/beautify
38	ln -sf /usr/lib/gimp/2.0/plug-ins/skin-whitening /usr/lib64/gimp/2.0/plug-ins/skin-whitening
39	ln -sf /usr/lib/gimp/2.0/plug-ins/simple-border /usr/lib64/gimp/2.0/plug-ins/simple-border
40	ln -sf /usr/lib/gimp/2.0/plug-ins/border /usr/lib64/gimp/2.0/plug-ins/border
41
42uninstall:
43	$(GIMPTOOL) --uninstall-admin-bin beautify
44	$(GIMPTOOL) --uninstall-admin-bin skin-whitening
45	$(GIMPTOOL) --uninstall-admin-bin simple-border
46	$(GIMPTOOL) --uninstall-admin-bin border
47	$(GIMPTOOL) --uninstall-admin-bin rip-border
48	$(GIMPTOOL) --uninstall-admin-bin texture-border
49	rm -f /usr/lib64/gimp/2.0/plug-ins/beautify
50	rm -f /usr/lib64/gimp/2.0/plug-ins/skin-whitening
51	rm -f /usr/lib64/gimp/2.0/plug-ins/border
52	rm -f /usr/lib64/gimp/2.0/plug-ins/simple-border
53	rm -f /usr/lib64/gimp/2.0/plug-ins/rip-border
54	rm -f /usr/lib64/gimp/2.0/plug-ins/texture-border
55
56userinstall: beautify skin-whitening simple-border border
57	$(GIMPTOOL) --install-bin beautify
58	$(GIMPTOOL) --install-bin skin-whitening
59	$(GIMPTOOL) --uninstall-bin rip-border
60	$(GIMPTOOL) --uninstall-bin texture-border
61	$(GIMPTOOL) --install-bin simple-border
62	$(GIMPTOOL) --install-bin border
63
64useruninstall:
65	$(GIMPTOOL) --uninstall-bin beautify
66	$(GIMPTOOL) --uninstall-bin skin-whitening
67	$(GIMPTOOL) --uninstall-bin simple-border
68	$(GIMPTOOL) --uninstall-bin border
69	$(GIMPTOOL) --uninstall-bin rip-border
70	$(GIMPTOOL) --uninstall-bin texture-border
71
72beautify: beautify.o beautify-effect.o
73	$(CC) -o $@ $^ $(LDFLAGS) $(LIBS)
74
75beautify.o: beautify.c
76	$(CC) $(CFLAGS) -c beautify.c -o beautify.o
77
78beautify-effect.o: beautify-effect.c beautify-textures.h
79	$(CC) $(CFLAGS) -c beautify-effect.c -o beautify-effect.o
80
81beautify-textures.h: beautify-textures.list
82	$(GDK_PIXBUF_CSOURCE) --raw --build-list `cat beautify-textures.list` > $(@F)
83
84skin-whitening: skin-whitening.o skin-whitening-effect.o
85	$(CC) -o $@ $^ $(LDFLAGS) $(LIBS)
86
87skin-whitening.o: skin-whitening.c skin-whitening-images.h
88	$(CC) $(CFLAGS) -c skin-whitening.c -o skin-whitening.o
89
90skin-whitening-images.h: skin-whitening-images.list
91	$(GDK_PIXBUF_CSOURCE) --raw --build-list `cat skin-whitening-images.list` > $(@F)
92
93skin-whitening-effect.o: skin-whitening-effect.c skin-whitening-effect.h
94	$(CC) $(CFLAGS) -c skin-whitening-effect.c -o skin-whitening-effect.o
95
96simple-border: simple-border.o
97	$(CC) -o $@ $^ $(LDFLAGS) $(LIBS)
98
99simple-border.o: simple-border.c simple-border-textures.h
100	$(CC) $(CFLAGS) -c simple-border.c -o simple-border.o
101
102simple-border-textures.h: simple-border-textures.list
103	$(GDK_PIXBUF_CSOURCE) --raw --build-list `cat simple-border-textures.list` > $(@F)
104
105border: border.o
106	$(CC) -o $@ $^ $(LDFLAGS) $(LIBS)
107
108border.o: border.c border-textures.h
109	$(CC) $(CFLAGS) -c border.c -o border.o
110
111border-textures.h: border-textures.list
112	$(GDK_PIXBUF_CSOURCE) --raw --build-list `cat border-textures.list` > $(@F)
113
114clean:
115	rm -f *.o beautify beautify-textures.h skin-whitening skin-whitening-images.h simple-border border border-textures.h rip-border rip-border-textures.h texture-border texture-border-textures.h
116
117