How to run makefile on windows

How to run makefile on windows

Как запустить makefile под WINDOWS.

How to run makefile on windows. Смотреть фото How to run makefile on windows. Смотреть картинку How to run makefile on windows. Картинка про How to run makefile on windows. Фото How to run makefile on windows

Не так давно я пересел на AtmelStudio6 с AVRStudio4. Есть у меня классный программатор клон STK500. Который просто прекрасно работает с 4й версией. Вот и получается, что пишу я теперь проги под 6й версией, а программатором пользуюсь из под 4ой. Неудобно как то. Попробовал подключить программатор к 6й. Работает через пень колоду. То работает, то не работает. Решил я сделать новый, чтоб работал по 6й версией и не пукал. Решил что это будет AVRISP mkII.

Нарыл я проект LUFA. ТУТ
Скачал код, а там торчит makefile. Самой прошивки там нет, чтоб сразу залить в микроконтроллер. Значит надо запустить сборку makefile чтоб родился hex файл. А как это сделать? Без понятия. А надо. Начал рыть. Помог один товарищ линуксоид. Вместе с ним поколупались и нарыли вот что.

1). Установить прогу mingw-get-inst-20120426.exe. В одном из окон при установке галочку поставить напротив msys. Эта прога есть здесь.

2). Установить прогу bc-1.06-2.exe. Отсюда.

3). Указать путь для переменной PATH в XP 32bit,

Переменная PATH находится здесь.
Компьютер/свойства/дополнительно/переменные среды.

C:\MinGW\msys\1.0\bin;
C:\Program Files\GnuWin32\bin;
C:\Program Files\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.2.939\avr8-gnu-toolchain\bin

Для WINDIWS_7 64bit
C:\MinGW\msys\1.0\bin;
C:\Program Files (x86)\GnuWin32\bin;
C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.2.939\avr8-gnu-toolchain\bin

4).Открыть консоль, зайти в нужную папку где находится файл make. Набрать команду make. Вот и все. Там же и появится желанный hex файл. Команда Make clean очищает от прежней сборки файлов.
Вот можно видео глянуть как это происходит.
Продолжение здесь.

Makefiles

Файлы makefile для каждого примера кода в этой серии являются универсальными файлами makefile Microsoft Win32 и предназначены для создания из окна командной строки. Предполагается, что компилятор и средства компоновщика (Майкрософт) потребуется внести некоторые изменения в работу с другими средствами. Большинство параметров командной строки компилятора и компоновщика задаются макросами, определенными в файле включения файла makefile Win32.mak, включенного в пакет SDK для платформы.

Файл Makeall.bat и каждый соответствующий пример файла makefile кода поддерживают общие параметры, перечисленные в следующей таблице, для вызова из окна командной строки для управления характером сборки.

Вызов NmakeВызов MakeallДействие
NmakemakeallСкомпилируйте данные отладки.
nmakenodebug=1makeall«nodebug=1»Компиляция без отладочной информации.
nmakeprofile=1makeall«profile=1»Скомпилируйте данные профилирования.
nmaketune=1makeall«tune=1»Сведения о рабочем наборе настройки.
nmakeunicode=1makeall«unicode=1»Компиляция для Юникода.
nmakecleanmakeallcleanУдалите временные двоичные файлы.
nmakecleanallmakeallcleanallУдалите все созданные файлы.

Для вызовов Makeall.bat необходимо иметь кавычки, как показано ниже. Параметры nodebug, profile и tune являются взаимоисключающими: вы можете использовать только один из них или ни один из них для заданной компиляции или ссылки. Чтобы скомпилировать примеры для выполнения со строками Юникода, используйте параметр «Юникод=1». По умолчанию используется компиляция для традиционной поддержки строк ANSI, так как затем можно запустить в любой 32-разрядной Windows операционной системе. Вы можете свободно компилировать и запускать с Юникодом или без нее на Windows Server 2003 и более поздних версий, а также Windows 2000 и более поздних версий. Имейте в виду, что APPUTIL всегда компилируется с теми же параметрами, что и другие примеры кода, которые можно компилировать отдельно. Это особенно верно для параметра «Юникод=1».

Для создания примеров можно использовать установленную 32-разрядную интегрированную среду разработки C++, используя предоставленные универсальные файлы makefile. Для этого требуется, чтобы в интегрированной среде разработки универсальные файлы makefile обрабатывались как внешние файлы makefile. Для предоставленных файлов makefile требуется служебная программа, совместимая с Microsoft NMAKE.

How to use GNU Make on Windows?

How to run makefile on windows. Смотреть фото How to run makefile on windows. Смотреть картинку How to run makefile on windows. Картинка про How to run makefile on windows. Фото How to run makefile on windows

7 Answers 7

Trending sort

Trending sort is based off of the default sorting method — by highest score — but it boosts votes that have happened recently, helping to surface more up-to-date answers.

It falls back to sorting by highest score if no posts are trending.

Switch to Trending sort

Explanation

Inside directory C:\MinGW\bin there is an executable file mingw32-make.exe which is the program make you are trying to run. You can use the keyword mingw32-make and run the program make since you have added the needed directory to the system path, but it is not an easy to remember keyword.

Solution

Renaming can be done:

Result

Now if you type make on command prompt it should output something like:

Which means the program make ran.

How to run makefile on windows. Смотреть фото How to run makefile on windows. Смотреть картинку How to run makefile on windows. Картинка про How to run makefile on windows. Фото How to run makefile on windows

I’m using GNU Make from the GnuWin32 project, see http://gnuwin32.sourceforge.net/ but there haven’t been any updates for a while now, so I’m not sure on this project’s status.

Although this question is old, it is still asked by many who use MSYS2.

I started to use it this year to replace CygWin, and I’m getting pretty satisfied.

As an alternative, if you just want to install make, you can use the chocolatey package manager to install gnu make by using

This deals with any path issues that you might have.

You can add the application folder to your path from a command prompt using:

setx PATH «%PATH%;c:\MinGW\bin»

Note that you will probably need to open a new command window for the modified path setting to go into effect.

user1594322 gave a correct answer but when I tried it I ran into admin/permission problems. I was able to copy ‘mingw32-make.exe’ and paste it, over-ruling/by-passing admin issues and then editing the copy to ‘make.exe’. On VirtualBox in a Win7 guest.

While make itself is available as a standalone executable ( gnuwin32.sourceforge.net package make ), using it in a proper development environment means using msys2.

Git 2.24 (Q4 2019) illustrates that:

test-tool run-command : learn to run (parts of) the testsuite

Signed-off-by: Johannes Schindelin

Git for Windows jumps through hoops to provide a development environment that allows to build Git and to run its test suite.

To that end, an entire MSYS2 system, including GNU make and GCC is offered as «the Git for Windows SDK».
It does come at a price: an initial download of said SDK weighs in with several hundreds of megabytes, and the unpacked SDK occupies

2GB of disk space.

A much more native development environment on Windows is Visual Studio. To help contributors use that environment, we already have a Makefile target vcxproj that generates a commit with project files (and other generated files), and Git for Windows’ vs/master branch is continuously re-generated using that target.

The idea is to allow building Git in Visual Studio, and to run individual tests using a Portable Git.

Makefile in Windows

I want to write a makefile to build these files(from folder X ) in windows command prompt. I have tried a lot but with no effect. First of all I need the make file format in Linux for this, and once I have that i will do that in Windows.

Can anybody help me in doing this?

4 Answers 4

Trending sort

Trending sort is based off of the default sorting method — by highest score — but it boosts votes that have happened recently, helping to surface more up-to-date answers.

It falls back to sorting by highest score if no posts are trending.

Switch to Trending sort

Try the following links, in there you’ll find the format, and basically all that you need to build your Makefile:

Open the folder ( X ) in file explorer.

Right click anywhere > new > text document.

Open up the makefile with your favorite text editor.

How to run makefile on windows. Смотреть фото How to run makefile on windows. Смотреть картинку How to run makefile on windows. Картинка про How to run makefile on windows. Фото How to run makefile on windows

You can use NMake, which is the windows alternative do Linux make. It is a command-line tool included with Visual Studio.

Although the syntax is very similar, you will find some differences. So the makefile that works on Linux may not work directly with NMake in windows.

In Linux, these lines for example:

In Windows, probably should be changed to:

So the makefile require edition to work with NMAKE in windows.

To use the makefile «as is», you should try a tool to mimic Linux commands in Windows, like Cygwin.

How to run a makefile in Windows?

I have some demos that I downloaded and they come with a Makefile.win and a Makefile.sgi. How can I run these in Windows to compile the demos?

19 Answers 19

Trending sort

Trending sort is based off of the default sorting method — by highest score — but it boosts votes that have happened recently, helping to surface more up-to-date answers.

It falls back to sorting by highest score if no posts are trending.

Switch to Trending sort

You can install GNU make with chocolatey, a well-maintained package manager, which will add make to the global path and runs on all CLIs (powershell, git bash, cmd, etc…) saving you a ton of time in both maintenance and initial setup to get make running.

Install the chocolatey package manager for Windows
compatible to Windows 7+ / Windows Server 2003+

Run choco install make

I am not affiliated with choco, but I highly recommend it, so far it has never let me down and I do have a talent for breaking software unintentionally.

If you have Visual Studio, run the Visual Studio Command prompt from the Start menu, change to the directory containing Makefile.win and type this:

You can also use the normal command prompt and run vsvars32.bat (c:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\Tools for VS2008). This will set up the environment to run nmake and find the compiler tools.

Check out cygwin, a Unix alike environment for Windows

Check out GnuWin’s make (for windows), which provides a native port for Windows (without requiring a full runtime environment like Cygwin)

If you have winget, you can install via the CLI like this:

Also, be sure to add the install path to your system PATH :

How to run makefile on windows. Смотреть фото How to run makefile on windows. Смотреть картинку How to run makefile on windows. Картинка про How to run makefile on windows. Фото How to run makefile on windows

Here is my quick and temporary way to run a Makefile

Plus, you can add arguments after the command, such as

How to run makefile on windows. Смотреть фото How to run makefile on windows. Смотреть картинку How to run makefile on windows. Картинка про How to run makefile on windows. Фото How to run makefile on windows

If you install Cygwin. Make sure to select make in the installer. You can then run the following command provided you have a Makefile.

I tried all of the above. What helps me:

Done! Now You might be able to use make-commands from any folder that contains Makefile.

How to run makefile on windows. Смотреть фото How to run makefile on windows. Смотреть картинку How to run makefile on windows. Картинка про How to run makefile on windows. Фото How to run makefile on windows

With Visual Studio 2017 I had to add this folder to my Windows 10 path env variable:

There’s also HostX86

I use MinGW tool set which provides mingw32-make build tool, if you have it in your PATH system variables, in Windows Command Prompt just go into the directory containing the files and type this command:

How to run makefile on windows. Смотреть фото How to run makefile on windows. Смотреть картинку How to run makefile on windows. Картинка про How to run makefile on windows. Фото How to run makefile on windows

Often standard Linux Makefiles are provided and NMake looks promising. However, the following link takes a simple Linux Makefile and explains some fundamental issues that one may encounter. It also suggests a few alternatives to handling Linux Makefiles on Windows.

Firstly, add path of visual studio common tools ( c:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools ) into the system path. To learn how to add a path into system path, please check this website: http://www.computerhope.com/issues/ch000549.htm. You just need to this once.

After that, whenever you need, open a command line and execute vsvars32.bat to add all required visual studio tools’ paths into the system path.

PS: Path of visual studio common tools might be different in your system. Please change it accordingly.

How to run makefile on windows. Смотреть фото How to run makefile on windows. Смотреть картинку How to run makefile on windows. Картинка про How to run makefile on windows. Фото How to run makefile on windows

I tried with cygwin & gnuwin, and didn’t worked for me, I guess because the makefile used mainly specific linux code.

What it worked was use Ubuntu Bash for Windows 10. This is a Marvel if you come from MAC as it is my case:

Extras:

Install msys2 with make dependency add both to PATH variable. (The second option is GNU ToolChain for Windows. MinGW version has already mingw32-make included.)

Install Git Bash. Run mingw32-make from Git Bash.

How to run makefile on windows. Смотреть фото How to run makefile on windows. Смотреть картинку How to run makefile on windows. Картинка про How to run makefile on windows. Фото How to run makefile on windows

How to run makefile on windows. Смотреть фото How to run makefile on windows. Смотреть картинку How to run makefile on windows. Картинка про How to run makefile on windows. Фото How to run makefile on windows

MinGW makefile generation with MinGW make command

Visual Studio makefile generation with VS equivalent make command

Источники информации:

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *