cake
/
p7utils
Archived
1
0
Fork 0

Slightly modified project structure

This commit is contained in:
Thomas Touhey 2017-01-11 15:36:42 +01:00
parent 49d655670e
commit df602baddb
5 changed files with 39 additions and 28 deletions

2
.gitignore vendored
View File

@ -2,3 +2,5 @@
/obj
/man
/p7*
.*.swp

View File

@ -125,7 +125,7 @@ define make-binaryobj-rule
ifeq ($(shell test -f $(SRCDIR)/$1/$2.c && echo y),y)
# - Out of a C source file
$(OBJDIR)/$1/$2.o: $(SRCDIR)/$1/$2.c | $(OBJDIR)/$1
$(call bcmd,cc,$$@,$(CC) -c -o $$@ $$< $(CFLAGS))
$(call bcmd,cc,$$@,$(CC) -c -o $$@ $$< $(CFLAGS_$1))
else
# - Out of an update.exe project
$(SRCDIR)/$1/$2.exe/$2.exe.bin:| $(SRCDIR)/$1/$2.exe
@ -148,7 +148,7 @@ $(eval $(call make-binaryobj-rule,$(bin),$(obj)))))
# Make a binary
define make-binary-rules
$1$(if $(FOR_WINDOWS),.exe): $(SRC_$1:%=$(OBJDIR)/$1/%.o) | $(OBJDIR)/$1
$(call bcmd,ld,$$@,$(LD) -o $$@ $$^ $(LDFLAGS) $(LDFLAGSb_$1))
$(call bcmd,ld,$$@,$(LD) -o $$@ $$^ $(LDFLAGS_$1))
all-$1: $1$(if $(FOR_WINDOWS),.exe)
clean-$1:

View File

@ -68,18 +68,14 @@ endif
-D MAINTAINER="$(MAINTAINER_NAME) <$(MAINTAINER_MAIL)>" \
-D DEFAULT_STORAGE="$(DEFAULT_STORAGE)" \
-D DEFAULT_ZOOM="$(DEFAULT_ZOOM)" \
$(shell $(PKGCONFIG) --cflags libp7 sdl 2>/dev/null) \
$(CMOREFLAGS)
# Linker
LD := $(TARGET)gcc
# - Specific linker flags
LDFLAGS_Linux := -Wl,-z,relro
# - Binary specific linker flags
LDFLAGSb_p7screen := $(shell $(PKGCONFIG) --libs sdl 2>/dev/null)
# - Linker flags
LDFLAGS := $(shell $(PKGCONFIG) --libs libp7 2>/dev/null) \
$(if $(FOR_WINDOWS),,$(LDFLAGS_Linux))
LDFLAGS := $(if $(FOR_WINDOWS),,$(LDFLAGS_Linux))
# Raw ELF object maker
LDR := $(TARGET)ld -r
@ -105,14 +101,26 @@ endif
-type d | sort))
DEFAULT_BINARIES := $(filter-out p7os,$(BINARIES))
# Get their libs
define get-binary-libs
LIBS_$1 := libp7 $(shell make -f $(SRCDIR)/$1/vars.mk libs 2>/dev/null)
endef
# Look for their sources
define get-binary-sources
SRC_$1 := $(basename $(shell find $(SRCDIR)/$1 \
-maxdepth 1 -mindepth 1 \
\( -name "*.c" -or -name "*.exe" \) \
-printf "%P\n" | sort))
# get the flags
CFLAGS_$1 := $(CFLAGS) $(shell pkg-config $(LIBS_$1) --cflags 2>/dev/null) \
-D BIN="$1$(if $(FOR_WINDOWS),.exe)"
LDFLAGS_$1 := $(LDFLAGS) $(shell pkg-config $(LIBS_$1) --libs 2>/dev/null)
endef
$(foreach bin,$(BINARIES), \
$(eval $(call get-binary-libs,$(bin))))
$(foreach bin,$(BINARIES), \
$(eval $(call get-binary-sources,$(bin))))
#******************************************************************************#
@ -139,3 +147,5 @@ define add-dest-dir
endef
$(if $(DESTDIR), $(foreach idir,IBINDIR IMANDIR, \
$(eval $(call add-dest-dir,$(idir)))))
# End of file.

View File

@ -19,7 +19,7 @@
/* ************************************************************************** */
/* Version message */
static const char version_message[] =
"p7 - from p7utils v" QUOTE(VERSION) " (licensed under GPLv2)\n"
QUOTE(BIN) " - from p7utils v" QUOTE(VERSION) " (licensed under GPLv2)\n"
"Maintained by " QUOTE(MAINTAINER) ".\n"
"\n"
"This is free software; see the source for copying conditions.\n"
@ -28,7 +28,7 @@ static const char version_message[] =
/* Main help message */
static const char help_main[] =
"Usage: p7 [--version|-v] [--help|-h] [--no-init] [--no-exit]\n"
"Usage: " QUOTE(BIN) " [--version|-v] [--help|-h] [--no-init] [--no-exit]\n"
" [--storage abc0] [--device /dev/omg0]\n"
" <subcommand> [options...]\n"
"\n"
@ -53,12 +53,16 @@ static const char help_main[] =
" --no-init Does not initialize connection (should only be used\n"
" when --no-exit was used last time p7 was called).\n"
"\n"
"Type \"p7 <subcommand> --help\" for some help about the subcommand.\n"
"Type \"" QUOTE(BIN) " <subcommand> --help\" for some help about the subcommand.\n"
"Report bugs to " QUOTE(MAINTAINER) ".";
/* Parts */
#define FOOT \
"\nType \"" QUOTE(BIN) " --help\" for other subcommands and general options."
/* Sending help message */
static const char help_send[] =
"Usage: p7 send [-f] [-o <on-calc filename>]\n"
"Usage: " QUOTE(BIN) " send [-f] [-o <on-calc filename>]\n"
" [-d <on-calc directory>] [-#] <local file>\n"
"Send a file to the calculator.\n"
"\n"
@ -69,12 +73,11 @@ static const char help_send[] =
" -d <dir> The directory on-calc in which the file will be stored (by\n"
" default, the root directory)\n"
" -# Display a nice little loading bar\n"
"\n"
"Type \"p7 --help\" for other subcommands and general options.";
FOOT;
/* Getting help message */
static const char help_get[] =
"Usage: p7 get [-o <local file>]\n"
"Usage: " QUOTE(BIN) " get [-o <local file>]\n"
" [-d <on-calc directory>] <on-calc filename>\n"
"Request a file from the calculator.\n"
"\n"
@ -83,8 +86,7 @@ static const char help_get[] =
" -d <dir> The directory on-calc in which to get the file (by default,\n"
" the root directory)\n"
" -# Display a nice little loading bar (if output isn't stdout)\n"
"\n"
"Type \"p7 --help\" for other subcommands and general options.";
FOOT;
/* Copying help message */
static const char help_copy[] =
@ -95,8 +97,7 @@ static const char help_copy[] =
"Options are:\n"
" -d <srcdir> The source directory (by default, the root directory)\n"
" -t <dstdir> The dest. directory (by default, the root directory)\n"
"\n"
"Type \"p7 --help\" for other subcommands and general options.";
FOOT;
/* Deleting help message */
static const char help_del[] =
@ -106,36 +107,31 @@ static const char help_del[] =
"Options are:\n"
" -d <dir> The directory on-calc in which to remove the file (by default,\n"
" the root directory)\n"
"\n"
"Type \"p7 --help\" for other subcommands and general options.";
FOOT;
/* Listing help message */
static const char help_ls[] =
"Usage: p7 ls\n"
"List files on the distant filesystem.\n"
"\n"
"Type \"p7 --help\" for other subcommands and general options.";
FOOT;
/* Resetting help message */
static const char help_reset[] =
"Usage: p7 reset\n"
"Reset the distant filesystem.\n"
"\n"
"Type \"p7 --help\" for other subcommands and general options.";
FOOT;
/* Optimizing help message */
static const char help_optimize[] =
"Usage: p7 optimize\n"
"Optimize the distant filesystem.\n"
"\n"
"Type \"p7 --help\" for other subcommands and general options.";
FOOT;
/* Dumping help message */
static const char help_info[] =
"Usage: p7 info\n"
"Dump information about the calculator.\n"
"\n"
"Type \"p7 --help\" for other subcommands and general options.";
FOOT;
/* ************************************************************************** */
/* Main function */

3
src/p7screen/vars.mk Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/make -f
libs:
@echo sdl