wip
This commit is contained in:
91
proj.c
91
proj.c
@@ -7,8 +7,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include "estruct.h"
|
#include "estruct.h"
|
||||||
|
#include "wrapper.h"
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "proj.h"
|
#include "proj.h"
|
||||||
@@ -48,6 +51,8 @@ int makeproj(char *src) {
|
|||||||
#include <stdlib.h>\n\
|
#include <stdlib.h>\n\
|
||||||
#include <string.h>\n\
|
#include <string.h>\n\
|
||||||
\n\
|
\n\
|
||||||
|
#include \"version.h\"\n\
|
||||||
|
\n\
|
||||||
void usage(int status)\n\
|
void usage(int status)\n\
|
||||||
{\n\
|
{\n\
|
||||||
printf(\"Usage: %%s REQUIRED POSITIONAL ARGUMENT\\n\", PROGRAM_NAME);\n\
|
printf(\"Usage: %%s REQUIRED POSITIONAL ARGUMENT\\n\", PROGRAM_NAME);\n\
|
||||||
@@ -71,14 +76,20 @@ int main(int argc, char **argv)\n\
|
|||||||
exit(EXIT_SUCCESS);\n\
|
exit(EXIT_SUCCESS);\n\
|
||||||
}\n\
|
}\n\
|
||||||
}\n\
|
}\n\
|
||||||
|
\n\
|
||||||
|
puts(\"Hello, World!\");\n\
|
||||||
\n\
|
\n\
|
||||||
return 0;\n\
|
return 0;\n\
|
||||||
}", src, author, src, src);
|
}", src, author, src, src);
|
||||||
|
|
||||||
|
size_t len = strlen(src) + 1 + strlen(author) + 6; /* account for " 1.0 " */
|
||||||
|
char *pad = xmalloc(len + 1);
|
||||||
|
memset(pad, '-', len);
|
||||||
|
pad[len] = '\0';
|
||||||
ffwrite("README", "\
|
ffwrite("README", "\
|
||||||
+--------------------+\n\
|
+%s+\n\
|
||||||
| %s/%s 1.0 |\n\
|
| %s/%s 1.0 |\n\
|
||||||
+--------------------+\n\
|
+%s+\n\
|
||||||
\n\
|
\n\
|
||||||
%s\n\
|
%s\n\
|
||||||
\n\
|
\n\
|
||||||
@@ -122,18 +133,90 @@ derived from uEmacs/PK 4.0 specifically from the Linux Torvalds\n\
|
|||||||
distribution on GitHub. The README on from uEmacs/PK 4.0 has greater and\n\
|
distribution on GitHub. The README on from uEmacs/PK 4.0 has greater and\n\
|
||||||
more accurate attributions, if you desire.\n\
|
more accurate attributions, if you desire.\n\
|
||||||
\n\
|
\n\
|
||||||
%s was generated using yait/fSD %s.\n\
|
%s was generated using %s %s\n\
|
||||||
\n\
|
\n\
|
||||||
LAST MODIFED DATE\
|
LAST MODIFED DATE\
|
||||||
",
|
",
|
||||||
|
pad,
|
||||||
src, author,
|
src, author,
|
||||||
|
pad,
|
||||||
description,
|
description,
|
||||||
src, author,
|
src, author,
|
||||||
src, year, author,
|
src, year, author,
|
||||||
src, author,
|
src, author,
|
||||||
src, author, description,
|
src, author, description,
|
||||||
src, author,
|
src, author,
|
||||||
src, VERSION);
|
src, PROGRAM_NAME_LONG, VERSION);
|
||||||
|
|
||||||
|
ffwrite("version.h", "\
|
||||||
|
#ifndef VERSION_H_\n\
|
||||||
|
#define VERSION_H_\n\
|
||||||
|
\n\
|
||||||
|
#define PROGRAM_NAME \"%s\"\n\
|
||||||
|
#define PROGRAM_NAME_LONG \"%s/%s\"\n\
|
||||||
|
\n\
|
||||||
|
#define VERSION \"1.0.0\"\n\
|
||||||
|
\n\
|
||||||
|
/* Print the version string. */\n\
|
||||||
|
void version(void);\n\
|
||||||
|
\n\
|
||||||
|
#endif /* VERSION_H_ */", src, src, author);
|
||||||
|
ffwrite("version.c", "\
|
||||||
|
#include <stdio.h>\n\
|
||||||
|
#include \"version.h\"\n\
|
||||||
|
\n\
|
||||||
|
void version(void)\n\
|
||||||
|
{\n\
|
||||||
|
printf(\"%%s version %%s\\n\", PROGRAM_NAME_LONG, VERSION);\n\
|
||||||
|
}");
|
||||||
|
|
||||||
|
ffwrite("Makefile", "\
|
||||||
|
# Makefile for %s\n\
|
||||||
|
\n\
|
||||||
|
# Make the build silent by default\n\
|
||||||
|
V =\n\
|
||||||
|
\n\
|
||||||
|
ifeq ($(strip $(V)),)\n\
|
||||||
|
E = @echo\n\
|
||||||
|
Q = @\n\
|
||||||
|
else\n\
|
||||||
|
E = @\\#\n\
|
||||||
|
Q =\n\
|
||||||
|
endif\n\
|
||||||
|
export E Q\n\
|
||||||
|
\n\
|
||||||
|
PROGRAM = %s\n\
|
||||||
|
TARBALL = $(PROGRAM).tar\n\
|
||||||
|
SRC = $(wildcard *.c)\n\
|
||||||
|
OBJ = $(SRC:.c=.o)\n\
|
||||||
|
HDR = $(wildcard *.h)\n\
|
||||||
|
\n\
|
||||||
|
CC = gcc\n\
|
||||||
|
WARNINGS = -Wall -Wstrict-prototypes\n\
|
||||||
|
CFLAGS = -O2 $(WARNINGS) -g\n\
|
||||||
|
DEFINES =\n\
|
||||||
|
LIBS =\n\
|
||||||
|
LDFLAGS =\n\
|
||||||
|
BINDIR = /usr/bin\n\
|
||||||
|
LIBDIR = /usr/lib\n\
|
||||||
|
\n\
|
||||||
|
$(PROGRAM): $(OBJ) $(HDR)\n\
|
||||||
|
$(E) \" LINK \" $@\n\
|
||||||
|
$(Q) $(CC) $(LDFLAGS) $(DEFINES) -o $@ $(OBJ) $(LIBS)\n\
|
||||||
|
\n\
|
||||||
|
clean:\n\
|
||||||
|
$(E) \" CLEAN\"\n\
|
||||||
|
$(Q) rm -f $(PROGRAM) $(OBJ)\n\
|
||||||
|
\n\
|
||||||
|
install: $(PROGRAM)\n\
|
||||||
|
cp $(PROGRAM) ${BINDIR}\n\
|
||||||
|
\n\
|
||||||
|
release: $(PROGRAM)\n\
|
||||||
|
tar cvf $(TARBALL) $(SRC) $(HDR) Makefile README\n\
|
||||||
|
\n\
|
||||||
|
.c.o:\n\
|
||||||
|
$(E) \" CC \" $@\n\
|
||||||
|
$(Q) $(CC) $(CFLAGS) $(DEFINES) -c $< -o $@", src, src);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user