parent
5e251b21fd
commit
12fdf6fc21
20
src/Makefile
20
src/Makefile
|
@ -1,8 +1,14 @@
|
||||||
PKG_CONFIG ?= pkg-config
|
PKG_CONFIG ?= pkg-config
|
||||||
LUAAPK ?= yes
|
|
||||||
|
|
||||||
LUA ?= $(firstword $(wildcard /usr/bin/lua5.3 /usr/bin/lua5.2))
|
LUA ?= $(firstword $(wildcard /usr/bin/lua5.3 /usr/bin/lua5.2))
|
||||||
|
|
||||||
|
ifeq ($(LUA),no)
|
||||||
|
LUAAPK ?= no
|
||||||
|
else ifneq ($(LUA),)
|
||||||
|
LUAAPK ?= yes
|
||||||
|
else
|
||||||
|
$(error Lua interpreter not found. Please specify LUA interpreter, or use LUA=no to build without help.)
|
||||||
|
endif
|
||||||
|
|
||||||
OPENSSL_CFLAGS := $(shell $(PKG_CONFIG) --cflags openssl)
|
OPENSSL_CFLAGS := $(shell $(PKG_CONFIG) --cflags openssl)
|
||||||
OPENSSL_LIBS := $(shell $(PKG_CONFIG) --libs openssl)
|
OPENSSL_LIBS := $(shell $(PKG_CONFIG) --libs openssl)
|
||||||
|
|
||||||
|
@ -86,10 +92,14 @@ LIBS := -Wl,--as-needed \
|
||||||
|
|
||||||
# Help generation
|
# Help generation
|
||||||
quiet_cmd_genhelp = GENHELP $@
|
quiet_cmd_genhelp = GENHELP $@
|
||||||
|
ifneq ($(LUA),no)
|
||||||
cmd_genhelp = $(LUA) $(src)/genhelp.lua $(filter %.scd, $^) > $@
|
cmd_genhelp = $(LUA) $(src)/genhelp.lua $(filter %.scd, $^) > $@
|
||||||
|
else
|
||||||
|
cmd_genhelp = echo \\\#define NO_HELP > $@
|
||||||
|
endif
|
||||||
|
|
||||||
$(obj)/help.h: $(src)/genhelp.lua $(wildcard doc/apk*.8.scd)
|
$(obj)/help.h: $(src)/genhelp.lua $(wildcard doc/apk*.8.scd) FORCE
|
||||||
@$(call echo-cmd,genhelp) $(cmd_genhelp)
|
$(call if_changed,genhelp)
|
||||||
|
|
||||||
CFLAGS_help.o := -I$(obj)
|
CFLAGS_help.o := -I$(obj)
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
#include "apk_applet.h"
|
#include "apk_applet.h"
|
||||||
#include "apk_print.h"
|
#include "apk_print.h"
|
||||||
|
|
||||||
static int is_group(struct apk_applet *applet, const char *topic)
|
static inline int is_group(struct apk_applet *applet, const char *topic)
|
||||||
{
|
{
|
||||||
if (!applet) return strcasecmp(topic, "apk") == 0;
|
if (!applet) return strcasecmp(topic, "apk") == 0;
|
||||||
if (strcasecmp(topic, applet->name) == 0) return 1;
|
if (strcasecmp(topic, applet->name) == 0) return 1;
|
||||||
|
@ -23,6 +23,7 @@ void apk_help(struct apk_applet *applet)
|
||||||
{
|
{
|
||||||
#include "help.h"
|
#include "help.h"
|
||||||
|
|
||||||
|
#ifndef NO_HELP
|
||||||
char buf[uncompressed_help_size], *ptr, *msg;
|
char buf[uncompressed_help_size], *ptr, *msg;
|
||||||
unsigned long len = sizeof buf;
|
unsigned long len = sizeof buf;
|
||||||
int num = 0;
|
int num = 0;
|
||||||
|
@ -38,4 +39,8 @@ void apk_help(struct apk_applet *applet)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (num == 0) apk_error("Help not found");
|
if (num == 0) apk_error("Help not found");
|
||||||
|
#else
|
||||||
|
fputc('\n', stdout);
|
||||||
|
apk_error("This apk-tools has been built without help");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue