Clean up make

This commit is contained in:
jun7 2018-06-06 14:10:35 +09:00
parent 646a42941a
commit 881c84fc95
2 changed files with 5 additions and 10 deletions

8
ab.c
View File

@ -30,13 +30,11 @@ along with wyebadblock. If not, see <http://www.gnu.org/licenses/>.
#if ISEXT #if ISEXT
#define EXE "wyebab"
#include <webkit2/webkit-web-extension.h> #include <webkit2/webkit-web-extension.h>
static bool check(const char *requri, const char *pageuri) static bool check(const char *requri, const char *pageuri)
{ {
char *uris = g_strconcat(requri, " ", pageuri, NULL); char *uris = g_strconcat(requri, " ", pageuri, NULL);
char *ruri = wyebget(EXE, uris); char *ruri = wyebget(EXENAME, uris);
g_free(uris); g_free(uris);
if (ruri && !*ruri) return false; if (ruri && !*ruri) return false;
@ -65,7 +63,7 @@ static gboolean reqcb(WebKitWebPage *kp, WebKitURIRequest *req,
static gboolean keepcb(WebKitWebPage *kp) static gboolean keepcb(WebKitWebPage *kp)
{ {
if (g_object_get_data(G_OBJECT(kp), "adblock") != (gpointer)'n') if (g_object_get_data(G_OBJECT(kp), "adblock") != (gpointer)'n')
wyebkeep(EXE, 30); wyebkeep(EXENAME, 30);
return true; return true;
} }
@ -140,7 +138,7 @@ static void init()
{ {
DD(wyebad init) DD(wyebad init)
char *path = g_build_filename( char *path = g_build_filename(
g_get_user_config_dir(), APPNAME, "easylist.txt", NULL); g_get_user_config_dir(), DIRNAME, "easylist.txt", NULL);
GFile *gf = g_file_new_for_path(path); GFile *gf = g_file_new_for_path(path);
GFileMonitor *gm = g_file_monitor_file(gf, GFileMonitor *gm = g_file_monitor_file(gf,

View File

@ -1,5 +1,4 @@
EXTENSION_DIR=$(DESTDIR)/usr/lib/wyebrowser EXTENSION_DIR=$(DESTDIR)/usr/lib/wyebrowser
DAPPNAME=-DAPPNAME='"wyebadblock"'
ifeq ($(DEBUG), 1) ifeq ($(DEBUG), 1)
CFLAGS += -Wall CFLAGS += -Wall
else else
@ -13,14 +12,12 @@ all: adblock.so wyebab librun.o testrun
adblock.so: ab.c ephy-uri-tester.c ephy-uri-tester.h librun.o makefile adblock.so: ab.c ephy-uri-tester.c ephy-uri-tester.h librun.o makefile
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< librun.o -shared -fPIC \ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< librun.o -shared -fPIC \
`pkg-config --cflags --libs gtk+-3.0 glib-2.0 webkit2gtk-4.0` \ `pkg-config --cflags --libs gtk+-3.0 glib-2.0 webkit2gtk-4.0` \
-DEXTENSION_DIR=\"$(EXTENSION_DIR)\" \ $(DDEBUG) -DISEXT -DEXENAME=\"wyebab\"
$(DDEBUG) -DISEXT
wyebab: ab.c ephy-uri-tester.c ephy-uri-tester.h librun.o makefile wyebab: ab.c ephy-uri-tester.c ephy-uri-tester.h librun.o makefile
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< librun.o \ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< librun.o \
`pkg-config --cflags --libs glib-2.0 gio-2.0` \ `pkg-config --cflags --libs glib-2.0 gio-2.0` \
-DEXTENSION_DIR=\"$(EXTENSION_DIR)\" \ $(DDEBUG) -DDIRNAME=\"wyebadblock\"
$(DDEBUG) $(DAPPNAME)
librun.o: wyebrun.c wyebrun.h makefile librun.o: wyebrun.c wyebrun.h makefile
$(CC) $(CFLAGS) $(LDFLAGS) -c -o $@ $< -fPIC\ $(CC) $(CFLAGS) $(LDFLAGS) -c -o $@ $< -fPIC\