diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2018-01-15 14:36:22 -0700 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2018-01-15 14:38:17 -0700 |
commit | 178921510fb527ef294b29b690ec2ac1ac696d8e (patch) | |
tree | 1fff6fbe3e2a6823a47a33a148d78f27a20f7ac6 /system-clock/genmake.pl | |
parent | 8519eb78ecf71da0d121d77265b9b70bc5f70561 (diff) | |
download | stm32l4-178921510fb527ef294b29b690ec2ac1ac696d8e.tar.gz stm32l4-178921510fb527ef294b29b690ec2ac1ac696d8e.tar.bz2 stm32l4-178921510fb527ef294b29b690ec2ac1ac696d8e.zip |
update the genmake system to put build files in their own directories
Diffstat (limited to 'system-clock/genmake.pl')
-rwxr-xr-x | system-clock/genmake.pl | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/system-clock/genmake.pl b/system-clock/genmake.pl index 26e91a8..80026b1 100755 --- a/system-clock/genmake.pl +++ b/system-clock/genmake.pl @@ -33,10 +33,14 @@ my $idempotency_cmd="ls *.c *.h| sha1sum | awk '{print \$ 1}'"; my $idempotency_cmd_make="ls *.c *.h | sha1sum | awk '{print \$\$1}'"; print "IDEMPOTENCY_HASH=" . `$idempotency_cmd` . "\n"; +my $arch_obs_dir = "_\$(PREFIX)_obs"; +print "$arch_obs_dir:\n\t"; +print "mkdir $arch_obs_dir\n"; + foreach $file (@files) { (my $file_no_ext = $file) =~ s/\.c$//g; - my $obj_file = "${file_no_ext}.o"; + my $obj_file = "$arch_obs_dir/${file_no_ext}.o"; my $c_file = "${file_no_ext}.c"; my $s_file = "${file_no_ext}.s"; @@ -46,7 +50,7 @@ foreach $file (@files) { my $deps_as_join = join(" ", @deps); # Emit the rule to make the object file. - print "$obj_file: $deps_as_join\n\t"; + print "$obj_file: $arch_obs_dir $deps_as_join\n\t"; print '$(CC) -c ' . $c_file . ' -o ' . $obj_file . ' $(CFLAGS)' . "\n\n"; # Emit the rule to make the assembly file. @@ -56,7 +60,8 @@ foreach $file (@files) { my $obj_files_deps = join(' ', @obj_files); print "FORCE:\n\t\n\n"; -print "main.elf: FORCE $obj_files_deps linker_script.ld\n\t"; +print "$arch_obs_dir/main.elf: FORCE $obj_files_deps linker_script.ld\n\t"; print "([ \"\$\$($idempotency_cmd_make)\" != \"\$(IDEMPOTENCY_HASH)\" ] " . "&& ./genmake.pl > Makefile && make main.elf ) " - . "|| " . '$(LD) -o main.elf $(LD_FLAGS) ' . "$obj_files_deps\n\n"; + . "|| " + . "\$(LD) -o $arch_obs_dir/main.elf \$(LD_FLAGS) $obj_files_deps\n\n"; |