Skip to content

Commit

Permalink
Merge pull request dlang#1469 from 9rnsr/vergen
Browse files Browse the repository at this point in the history
Use VERSION file to generate version string
  • Loading branch information
WalterBright committed Jan 13, 2013
2 parents 9a04060 + a422654 commit 73649ea
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/mars.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@ Global::Global()
"\nMSIL back-end (alpha release) by Cristian L. Vlasceanu and associates.";
#endif
;
version = "v2.062";
version = "v"
#include "verstr.h"
;

global.structalign = STRUCTALIGN_DEFAULT;

memset(&params, 0, sizeof(Param));
Expand Down
8 changes: 7 additions & 1 deletion src/posix.mak
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,12 @@ impcnvgen : mtype.h impcnvgen.c
$(ENVP) $(CC) $(CFLAGS) impcnvgen.c -o impcnvgen
./impcnvgen

######### vergen generates some source

verstr.h : vergen.c ../VERSION
$(ENVP) $(CC) vergen.c -o vergen
cat ../VERSION | ./vergen > verstr.h

#########

$(DMD_OBJS) : $(idgen_output) $(optabgen_output) $(impcnvgen_output)
Expand Down Expand Up @@ -489,7 +495,7 @@ man.o: $(ROOT)/man.c
mangle.o: mangle.c
$(CC) -c $(CFLAGS) $<

mars.o: mars.c
mars.o: mars.c verstr.h
$(CC) -c $(CFLAGS) $<

rmem.o: $(ROOT)/rmem.c
Expand Down
17 changes: 17 additions & 0 deletions src/vergen.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>

int main() {
int c;

printf("\"", c);
while ((c = fgetc(stdin)) != EOF) {
if (c == '\n') break;
printf("%c", c);
}
printf("\"");

return EXIT_SUCCESS;
}
6 changes: 5 additions & 1 deletion src/win32.mak
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,10 @@ id.h id.c : idgen.c
$(CC) -cpp -DDM_TARGET_CPU_X86=1 idgen
idgen

verstr.h : vergen.c ..\VERSION
$(CC) -cpp -DDM_TARGET_CPU_X86=1 vergen
type ..\VERSION | vergen > verstr.h

############################# Intermediate Rules ############################

# Default rules
Expand Down Expand Up @@ -524,7 +528,7 @@ glue.obj : $(CH) $(TOTALH) $C\rtlsym.h mars.h module.h glue.c
imphint.obj : imphint.c
$(CC) -c $(CFLAGS) $*

mars.obj : $(TOTALH) module.h mars.h mars.c
mars.obj : $(TOTALH) module.h mars.h mars.c verstr.h
$(CC) -c $(CFLAGS) $(PREC) $* -Ae

md5.obj : $C\md5.h $C\md5.c
Expand Down

0 comments on commit 73649ea

Please sign in to comment.