0

I'm trying to learn how to create a makefile and I faced couple of issues related to commands which I should use.

  1. ls is something i know to list directories.
  2. rm is something I know to remove file or directory and some other.

Then I learnt that Unix-cmd is different from command prompt in windows and also from powershell.

I'm using Windows 11 to create a make file. and I found alternate commands for the above like

  1. dir /a:b, instead of ls
  2. erase instead of rm.

What is the difference btw these shells and where to find them?

Makefile:

print: $(wildcard *.c)
    ls -la $?

Error I got: ls

'ls' is not recognized as an internal or external command,
operable program or batch file

I want to know a little more info about them. Also what makes are available something which gives some overview. Names are sufficient.

V B
  • 75
  • 5
  • 1
    On Windows, use [MSYS2](https://stackoverflow.com/q/30069830/2752075)'s `make`. It gives you the same environment as you'd get on any other platform (`sh` shell, and the commands you'd normally see on *nix). – HolyBlackCat Oct 11 '22 at 04:55
  • 1
    Your terminology is confused. `cmd.exe` is specifically the legacy Windows command interpreter. The command interpreter on Unlix-like systems is usually called the "shell". – tripleee Oct 11 '22 at 07:00
  • 1
    `make` as such does not require you to write recipes in any particular language, but the overwhelming standard practice is for `Makefile`s to use `sh` specifically. If you wanted to learn Make at your own leisure, using `cmd` as your local shell for playing around should be fine. – tripleee Oct 11 '22 at 07:01
  • 1
    Windows out of the box does not have `sh`, though you can install it if you want to. A common arrangement is to install Git, which includes Bash, which is backwards-compatible with POSIX `sh` – tripleee Oct 11 '22 at 07:02
  • @tripleee: I agree. I'm very new to software development, but learning at quite good speed. So to conclude, cmd.exe is a windows command interpreter and shell is a *nix (unix) command interpreter. – V B Oct 11 '22 at 07:07
  • A shell means a command interpreter. Cmd, Powershell, sh, and others are shells. – HolyBlackCat Oct 11 '22 at 07:54

0 Answers0