mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-10-29 17:54:14 +08:00
Merge pull request #420 from DrDoof/fix/static-build-determinism
Make the static-file build repeatable
This commit is contained in:
2 files changed
+16
-9
No files matched your search
@@ -112,11 +112,14 @@ html_min: $(HTML)
|
||||
html_data.c html_data.h &: $(HTML) | tools html_min
|
||||
tools/output/fileadder -a $(HTML_LOCATION) -s $(IMAGESIZE) -b BANK1 -z -d $(HTML_MIN) -p html_data
|
||||
|
||||
$(VERSION_HEADER):
|
||||
$(VERSION_HEADER): FORCE
|
||||
@printf '%s\n' "#ifndef VERSION_H" "#define VERSION_H" \
|
||||
"#define VERSION_SW \"$(VERSION_EXTENSION)\"" \
|
||||
"#define BUILD_DATE \"$(BUILD_DATE)\"" \
|
||||
"#endif" > $(VERSION_HEADER)
|
||||
"#endif" > $(VERSION_HEADER).tmp
|
||||
@cmp -s $(VERSION_HEADER).tmp $(VERSION_HEADER) \
|
||||
&& rm -f $(VERSION_HEADER).tmp \
|
||||
|| mv $(VERSION_HEADER).tmp $(VERSION_HEADER)
|
||||
|
||||
httpd: html_data.h
|
||||
|
||||
@@ -162,11 +165,11 @@ $(BUILDDIR)/rtlplayground-$(FILENAME_EXTENSION).bin: $(BUILDDIR)/rtlplayground.i
|
||||
tools/output/imagebuilder -i $^ $@
|
||||
tools/output/fileadder -a $(DEFAULT_CONFIG_LOCATION) -s $(IMAGESIZE) -d config.txt $@
|
||||
tools/output/fileadder -a $(CONFIG_LOCATION) -s $(IMAGESIZE) -d config.txt $@
|
||||
tools/output/fileadder -a $(HTML_LOCATION) -s $(IMAGESIZE) -z -d $(HTML_MIN) -p html_data -b BANK1 $@
|
||||
tools/output/fileadder -a $(HTML_LOCATION) -s $(IMAGESIZE) -z -d $(HTML_MIN) -b BANK1 $@
|
||||
tools/output/crc_calculator -u $@
|
||||
ln -sf $(MACHINE)/rtlplayground-$(FILENAME_EXTENSION).bin output/rtlplayground.bin
|
||||
|
||||
.PHONY: clean distclean all $(SUBDIRS) $(SUBDIRSCLEAN) $(VERSION_HEADER) create_build_dir
|
||||
.PHONY: clean distclean all $(SUBDIRS) $(SUBDIRSCLEAN) create_build_dir
|
||||
|
||||
.PHONY:
|
||||
machine_check:
|
||||
|
||||
+9
-5
@@ -338,15 +338,16 @@ int main(int argc, char **argv)
|
||||
if (stat(arguments.data_file, &s) == 0 && s.st_mode & S_IFDIR) {
|
||||
printf("Adding entries in directory %s\n", arguments.data_file);
|
||||
addsDir = true;
|
||||
DIR *dirptr = opendir(arguments.data_file);
|
||||
if (!dirptr) {
|
||||
struct dirent **entries;
|
||||
int n_entries = scandir(arguments.data_file, &entries, NULL, alphasort);
|
||||
if (n_entries < 0) {
|
||||
fprintf(stderr, "%s: ", arguments.data_file);
|
||||
perror("Error opening directory");
|
||||
return 5;
|
||||
}
|
||||
struct dirent *in_file;
|
||||
int addr = arguments.address;
|
||||
while ( (in_file = readdir(dirptr)) ) {
|
||||
for (int e = 0; e < n_entries; e++) {
|
||||
struct dirent *in_file = entries[e];
|
||||
snprintf(pathbuffer, PATH_SIZE, "%s/%s", arguments.data_file, in_file->d_name);
|
||||
if (stat(pathbuffer, &s) < 0) {
|
||||
fprintf(stderr, "%s: ", pathbuffer);
|
||||
@@ -377,6 +378,9 @@ int main(int argc, char **argv)
|
||||
addidx(in_file->d_name, addr, data_read);
|
||||
addr += data_read;
|
||||
}
|
||||
for (int e = 0; e < n_entries; e++)
|
||||
free(entries[e]);
|
||||
free(entries);
|
||||
} else {
|
||||
size_t data_read = addfile(arguments.data_file, arguments.address);
|
||||
|
||||
@@ -437,7 +441,7 @@ int main(int argc, char **argv)
|
||||
fputs(xbuf, ofile);
|
||||
fputs(fbuf, ofile);
|
||||
fclose(ofile);
|
||||
} else if (addsDir){
|
||||
} else if (addsDir && !argv[arg_index]) {
|
||||
puts(dbuf);
|
||||
puts(xbuf);
|
||||
puts(ibuf);
|
||||
|
||||
Reference in new issue
Block a user