targets=arch.exe basename.exe cat.exe dmesg.exe dirname.exe driver.exe echo.exe false.exe hostname.exe ls.exe printenv.exe sleep.exe sync.exe syncd.exe true.exe helpers=writestr.o stringify_int.o ldargs=-m elf_i386 all: $(helpers) $(targets) helpers: $(helpers) arch.exe: arch.o writestr.o ld $(ldargs) -e arch -g -static -o $@ $^ basename.exe: basename.o writestr.o ld $(ldargs) -e basename -g -static -o $@ $^ cat.exe: cat.o writestr.o ld $(ldargs) -e cat -g -static -o $@ $^ driver.exe: driver.o writestr.o arch.o basename.o dirname.o dmesg.o echo.o false.o hostname.o printenv.o sleep.o sync.o syncd.o true.o ld $(ldargs) -e driver -g -static -o $@ $^ dirname.exe: dirname.o writestr.o ld $(ldargs) -e dirname -g -static -o $@ $^ echo.exe: echo.o writestr.o ld $(ldargs) -e echo -g -static -o $@ $^ hostname.exe: hostname.o writestr.o ld $(ldargs) -e hostname -g -static -o $@ $^ ls.exe: ls.o writestr.o ld $(ldargs) -e ls -g -static -o $@ $^ printenv.exe: printenv.o writestr.o ld $(ldargs) -e printenv -g -static -o $@ $^ write.exe: write.o writestr.o stringify_int.o ld $(ldargs) -e write -g -static -o $@ $^ %.exe: %.o ld $(ldargs) -e $* -g -static -o $@ $*.o %.o: %.s cpp $*.s $*-cpp.s as --32 -g -o $*.o $*-cpp.s clean: rm -f *-cpp.s *.o rm -f $(targets)