diff --git a/.gitignore b/.gitignore index f51cde8..89ceba1 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ /obj /man /p7* + +.*.swp diff --git a/Makefile b/Makefile index f1ab920..b7aa5a1 100755 --- a/Makefile +++ b/Makefile @@ -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: diff --git a/Makefile.vars b/Makefile.vars index f4fb59e..e61d4eb 100755 --- a/Makefile.vars +++ b/Makefile.vars @@ -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. diff --git a/src/p7/args.c b/src/p7/args.c index 969a7d1..0aac282 100644 --- a/src/p7/args.c +++ b/src/p7/args.c @@ -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" " [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 --help\" for some help about the subcommand.\n" +"Type \"" QUOTE(BIN) " --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 ]\n" +"Usage: " QUOTE(BIN) " send [-f] [-o ]\n" " [-d ] [-#] \n" "Send a file to the calculator.\n" "\n" @@ -69,12 +73,11 @@ static const char help_send[] = " -d 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 ]\n" +"Usage: " QUOTE(BIN) " get [-o ]\n" " [-d ] \n" "Request a file from the calculator.\n" "\n" @@ -83,8 +86,7 @@ static const char help_get[] = " -d 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 The source directory (by default, the root directory)\n" " -t 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 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 */ diff --git a/src/p7screen/vars.mk b/src/p7screen/vars.mk new file mode 100755 index 0000000..335970b --- /dev/null +++ b/src/p7screen/vars.mk @@ -0,0 +1,3 @@ +#!/usr/bin/make -f +libs: + @echo sdl