Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/fpm.f90
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module fpm
fpm_run_settings, fpm_install_settings, fpm_test_settings
use fpm_dependency, only : new_dependency_tree
use fpm_environment, only: run, get_env
use fpm_filesystem, only: is_dir, join_path, number_of_rows, list_files, exists, basename
use fpm_filesystem, only: is_dir, join_path, number_of_rows, list_files, exists, basename, filewrite, mkdir
use fpm_model, only: fpm_model_t, srcfile_t, show_model, &
FPM_SCOPE_UNKNOWN, FPM_SCOPE_LIB, FPM_SCOPE_DEP, &
FPM_SCOPE_APP, FPM_SCOPE_EXAMPLE, FPM_SCOPE_TEST
Expand Down Expand Up @@ -58,6 +58,11 @@ subroutine build_model(model, settings, package, error)
call model%deps%add(package, error)
if (allocated(error)) return

! build/ directory should now exist
if (.not.exists("build/.gitignore")) then
call filewrite(join_path("build", ".gitignore"),["*"])
end if

if(settings%compiler.eq.'')then
model%fortran_compiler = 'gfortran'
else
Expand Down
3 changes: 0 additions & 3 deletions src/fpm/cmd/new.f90
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,6 @@ subroutine cmd_new(settings)
! like realpath() or getcwd().
bname=basename(settings%name)

! create NAME/.gitignore file
call warnwrite(join_path(settings%name, '.gitignore'), ['build/*'])

littlefile=[character(len=80) :: '# '//bname, 'My cool new project!']

! create NAME/README.md
Expand Down
3 changes: 2 additions & 1 deletion src/fpm/cmd/update.f90
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module fpm_cmd_update
use fpm_command_line, only : fpm_update_settings
use fpm_dependency, only : dependency_tree_t, new_dependency_tree
use fpm_error, only : error_t, fpm_stop
use fpm_filesystem, only : exists, mkdir, join_path, delete_file
use fpm_filesystem, only : exists, mkdir, join_path, delete_file, filewrite
use fpm_manifest, only : package_config_t, get_package_data
implicit none
private
Expand All @@ -26,6 +26,7 @@ subroutine cmd_update(settings)

if (.not.exists("build")) then
call mkdir("build")
call filewrite(join_path("build", ".gitignore"),["*"])
end if

cache = join_path("build", "cache.toml")
Expand Down
7 changes: 2 additions & 5 deletions src/fpm_command_line.f90
Original file line number Diff line number Diff line change
Expand Up @@ -936,14 +936,11 @@ subroutine set_help()
' o runs the command "git init" in that directory ', &
' o populates the directory with the default project directories ', &
' o adds sample Fortran source files ', &
' o adds a ".gitignore" file for ignoring the build/ directory ', &
' (where fpm-generated output will be placed) ', &
' ', &
' The default file structure (that will be automatically scanned) is ', &
' ', &
' NAME/ ', &
' fpm.toml ', &
' .gitignore ', &
' src/ ', &
' NAME.f90 ', &
' app/ ', &
Expand Down Expand Up @@ -1004,8 +1001,8 @@ subroutine set_help()
' depend extensively on non-default build options. ', &
' ', &
' --bare A minimal manifest file ("fpm.toml") is created and ', &
' a ".gitignore" and "README.md" file is created but no ', &
' directories or sample Fortran is generated. ', &
' "README.md" file is created but no directories or ', &
' sample Fortran are generated. ', &
' ', &
' --help print this help and exit ', &
' --version print program version information and exit ', &
Expand Down