mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
zdev: generate usage text headers instead of C files
Generating and then including C source files from another C file can lead to unexpected compilation errors in certain environments. Switch the usage text generation from %_usage.c to %_usage.h. The generated header provides the usage_text definition directly, and chzdev.c and lszdev.c include the corresponding *_usage.h instead. Update depfile prerequisites and the clean target to match the new generated artifacts. Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com> Signed-off-by: Jan Polensky <japo@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
committed by
Jan Höppner
parent
d8cea21e1e
commit
43cf7873be
@@ -86,11 +86,13 @@ endif
|
||||
|
||||
CSTR_SED = -e 's/\\/\\\\/g' -e 's/"/\\"/g' -e 's/^/"/g' -e 's/$$/\\n"/g'
|
||||
|
||||
%_usage.c: %_usage.txt
|
||||
$(SED) $(CSTR_SED) $< >$@
|
||||
%_usage.h: %_usage.txt
|
||||
@echo 'static const char *usage_text =' >$@
|
||||
@$(SED) $(CSTR_SED) $< >>$@
|
||||
@echo ';' >>$@
|
||||
|
||||
.chzdev.o.d: chzdev_usage.c
|
||||
.lszdev.o.d: lszdev_usage.c
|
||||
.chzdev.o.d: chzdev_usage.h
|
||||
.lszdev.o.d: lszdev_usage.h
|
||||
|
||||
libs = $(rootdir)/libap/libap.a \
|
||||
$(rootdir)/libutil/libutil.a
|
||||
@@ -113,6 +115,6 @@ ifeq ($(HAVE_DRACUT),1)
|
||||
endif
|
||||
|
||||
clean:
|
||||
@rm -f *.o chzdev lszdev chzdev_usage.c lszdev_usage.c gmon.out *.gcda *.gcno zdev_id
|
||||
@rm -f *.o chzdev lszdev chzdev_usage.h lszdev_usage.h gmon.out *.gcda *.gcno zdev_id
|
||||
|
||||
.PHONY: all install clean
|
||||
|
||||
@@ -111,10 +111,8 @@ struct options {
|
||||
unsigned int no_module_load:1;
|
||||
};
|
||||
|
||||
/* Makefile converts chzdev_usage.txt into C file which we include here. */
|
||||
static const char *usage_text =
|
||||
#include "chzdev_usage.c"
|
||||
;
|
||||
/* Makefile converts chzdev_usage.txt into header file which we include here. */
|
||||
#include "chzdev_usage.h"
|
||||
|
||||
#define OPT_ANONYMOUS_BASE 0x80
|
||||
enum {
|
||||
|
||||
@@ -76,10 +76,8 @@ struct options {
|
||||
unsigned int site_id;
|
||||
};
|
||||
|
||||
/* Makefile converts lszdev_usage.txt into C file which we include here. */
|
||||
static const char *usage_text =
|
||||
#include "lszdev_usage.c"
|
||||
;
|
||||
/* Makefile converts lszdev_usage.txt into header file which we include here. */
|
||||
#include "lszdev_usage.h"
|
||||
|
||||
#define OPT_ANONYMOUS_BASE 0x80
|
||||
enum {
|
||||
|
||||
Reference in New Issue
Block a user