I'm trying to create a Makefile that works on both Windows and Linux. Running make clean generates the following error:
process_begin: CreateProcess(NULL, rmdir /s /q D:\Documents\Programming\project\bin, ...) failed.
make: Makefile:13: pipe: No such file or directory
process_begin: CreateProcess(NULL, rmdir /s /q D:\Documents\Programming\project\obj, ...) failed.
make: Makefile:15: pipe: No such file or directory
The relevant parts of the Makefile are:
BIN_DIR=bin
OBJ_DIR=obj
SRC_DIR=src
ifeq ($(OS),Windows_NT)
RMDIR=$(shell rmdir /s /q $(subst /,\,$(abspath $1)))
else
RMDIR=$(shell rm -rf $(abspath $1))
endif
clean:
#echo "RM $(BIN_DIR)"
#$(call RMDIR,$(BIN_DIR))
#echo "RM $(OBJ_DIR)"
#$(call RMDIR,$(OBJ_DIR))
#echo "Done!"
.PHONY: clean
The project structure looks like this:
├─bin
├─obj
├─src
└─Makefile
Related
I am trying to compile a bunch of c files but for some reason compiler won't detect the header files which are located in the same exact folder. Here is the error I am getting
C:\Users\bz733p\Desktop\EBI20\source\application.c:45:25: fatal error: application.h: No such file or directory
compilation terminated.
Batch file:
set COMP_DIR=C:\Users\xxxx\Desktop\EBI20\source
set BIN_DIR=C:\Apps\opentoolsuite\runtime\msys\gcc\4.5.1-tdm-x32\bin
set CFLAGS=-g -Wall -m32
:: Clean
echo Cleaning directory...
::call clean.bat
:: Start the build
::COMPiling
echo COMPiling files....
for %%i in ("%COMP_DIR%\*.C")do %BIN_DIR%\i686-w64-mingw32-gcc-4.5.1.exe -c %CFLAGS% "%%~i" -o "%%~dpni.o" > results.txt
pause
I verified that both files are located in the same directory Files in directory. This happens for all header files in the directory. I looked into but could not find any solution
So I'm currently working on my own OS (just for fun), and it's currently being compiled into an IMG file. I know it's not needed but I would like to try and compile it into an ISO, but so far I've had no luck with it. I'm not quite sure which files are needed, so just ask for them and I will edit the post :)
When I run the img I get this:
But when I run the ISO I get this:
Here's my compile script I wrote in batch:
#echo off
echo Building KronkOS floppy image!
echo.
echo Assembling bootloader...
echo ======================================================
wsl nasm -f bin bootloader/boot.asm -o bootloader/boot.bin
echo Done!
echo.
echo Assembling KronkOS kernel...
echo ======================================================
wsl nasm -f bin kernel.asm -o KERNEL.BIN -l kernel_list.lst
echo Done!
::echo.
::echo Creating elf kernel file...
::echo ======================================================
::wsl nasm -f elf32 -o kernel.o kernel.asm
::wsl ld -m elf_i386 -o kernel.elf kernel.o
::del kernel.o
::echo Done!
::echo.
::echo Assembling programs...
::echo ======================================================
::cd programs
:: for %%i in (*.BKF) do del %%i
:: for %%i in (*.ASM) do wsl nasm -O0 -f BIN %%i
:: for %%i in (*.) do ren %%i %%i.BKF
::cd ..
::echo Done!
echo.
echo Adding bootsector to disk image...
echo ======================================================
wsl mformat -f 1440 -B bootloader/boot.bin -C -i images/KronkOS.img
echo.
echo Done!
echo.
echo Copying kernel and applications to disk image...
echo ======================================================
wsl mcopy -D o -i images/KronkOS.img KERNEL.BIN ::/
wsl mcopy -D o -i images/KronkOS.img programs/*.BKF ::/
wsl mcopy -D o -i images/KronkOS.img programs/*.BAS ::/
echo.
echo Done!
echo.
echo Do you want to build and ISO?
echo ======================================================
choice /c YN
if errorlevel 1 set x=1
if errorlevel 2 set x=2
if "%x%" == "1" (
cd images
wsl genisoimage -input-charset utf-8 -o KronkISO.iso -V KRONKOS -b KronkOS.img ./
cd..
echo.
echo Done!
)
echo.
echo ======================================================
echo Build done!
choice /c YN /m "Run KronkOS build in QEMU?"
if errorlevel 1 set y=1
if errorlevel 2 set y=2
if "%y%" == "1" (
if "%1" == "-d" (
wsl sh -c "export DISPLAY=0:0 && qemu-system-x86_64 -s -S -fda images/KronkOS.img"
) else (
if "%x%" == "1" (
wsl sh -c "export DISPLAY=0:0 && qemu-system-x86_64 images/KronkISO.iso"
) else (
wsl sh -c "export DISPLAY=0:0 && qemu-system-x86_64 -fda images/KronkOS.img"
)
)
)'
cls
So I changed the tool I used to convert it into an ISO from fat_imgen to mtools.I also followed what Michael Petch suggested in a comment which was to use the -cdrom option in qemu, and now everything seems to work as it should.
I'm trying to make a modified version of the FlySky FS-i6 firmware. After a bit of searching, I found someone who decompiled the source code here.
I'm trying to compile using arm-none-eabi, which I already have installed from the Arduino IDE.
Here's a batch file I made to compile the files, which are just a bunch of .c and .h files under several directories, but I have no clue what arguments I'm supposed to be giving the arm-none-eabi-gcc command...
#echo off
set EABI_PATH="%LocalAppData%\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1\bin"
#RD /S /Q temp
mkdir temp
for /D %%d in (*) do (
echo ---- Compiling Directory: %%d
rem C Files:
for %%f in (%%d/*.c) do (
"%EABI_PATH%/arm-none-eabi-gcc" -c -mcpu=cortex-m0plus -g "%%d/%%f" -o "temp/%%~nf.o" -mthumb -g3
)
rem Header Files:
rem for %%f in (%%d/*.h) do (
rem "%EABI_PATH%/arm-none-eabi-gcc" -c -mcpu=cortex-m0plus -g "%%d/%%f" -o "temp/%%~nf.o" -mthumb -g3
rem )
)
I've searched everywhere, but I can't find any tutorials or anything about how to use the tool. All I want to do is compile the files to a firmware.hex file, you'd think it would just be a simple one-liner...
I created this makefile almost two years ago in Windows 7:
SRC_DIRS = ./src/oasis ./src/oasis/commands/basic ./src/oasis/commands/immortal ./src/oasis/commands/socials ./src/oasis/util
COMPILE_FLAGS = -d ./classes
DOC_FLAGS = -quiet -private -d ./doc -sourcepath ./src -subpackages oasis -linkoffline http://java.sun.com/j2se/1.4.2/docs/api .
all:
#echo Compiling source code...
#javac $(COMPILE_FLAGS) $(foreach dir,$(SRC_DIRS),$(dir)/*.java)
#echo Creating javadocs...
#javadoc $(DOC_FLAGS)
#echo Done.
class:
#echo Compiling source code...
#javac $(COMPILE_FLAGS) $(foreach dir,$(SRC_DIRS),$(dir)/*.java)
#echo Done.
docs:
#echo Creating javadocs...
#javadoc $(DOC_FLAGS)
#echo Done.
clean:
#echo Removing classes...
#rmdir classes /q /s
#mkdir classes
#echo Removing javadocs...
#rmdir doc /q /s
#mkdir doc
#echo Done.
I used to navigate to its folder with cmd.exe, and then type "make all" or "make class" or whatever... and it would work! Now I'm returning to this project almost 2 years later, on a new computer (also Windows 7) and the "make" command isn't recognized. I don't remember installing any special software to use makefiles in Windows. Why won't it work anymore?
I have a makefile as follows.. At the first line that says windows.. Then on that same line, I try to set the variable to windows and jmp to $(WinDIR)/$(WinOUT)
How can I do that?
windows: ObjDIR=Windows $(WinDIR)/$(WinOUT)
#echo
#echo "Finished Making windows.."
clean:
#echo " Cleaning Build Files."
#rm -rf $(BinDIR) $(ObjDIR)
$(WinDIR)/$(WinOUT): $(ObjFiles)
#echo
#echo "Linking Object Files.."
Um...
windows: ObjDIR=Windows
windows: $(WinDIR)/$(WinOUT)
#echo
#echo "Finished Making windows.."
But I'm not sure you understand how Make works. It won't "jump to" $(WinDIR)/$(WinOUT), it will -- perhaps -- execute the $(WinDIR)/$(WinOUT) rule first.