makefile

来自「一个类linux的dos下开发的操作系统.」· 代码 · 共 47 行

TXT
47
字号
# need this for DJGPP MAKE, omit for Borland MAKE
# be sure the MAKE you want is first on the command search path
.SUFFIXES: .asm .bin .com

# Borland MAKE 2.0 has no "-f" option; uses only makefiles named 'makefile'
MAKEDEP=makefile
CFLAGS	=-v -mt -w -O2 -d -Z -1
# change LIBPATH depending on what version of Turbo/Borland C you use
LIBPATH	=c:\t\lib
LFLAGS	=/x/c

# targets
all: stage1\fat12-f.bin stage1\fat16-hd.bin stage2\loader.bin

install: stage1\fat12-f.bin stage2\loader.bin
	partcopy stage1\fat12-f.bin  0   3 -f0
	partcopy stage1\fat12-f.bin 24 1DC -f0 24
	copy /y stage2\loader.bin a:

clean:
# Borland MAKE 2.0 needs "command /c"
	command /c for %f in (stage1\*.bin stage1\*.lst stage2\*.o stage2\*.bin) do del %f

# dependencies
stage1\fat12-f.bin: stage1\fat12-f.asm $(MAKEDEP)

stage1\fat16-hd.bin: stage1\fat16-hd.asm $(MAKEDEP)

stage2\boot.o: stage2\boot.c $(MAKEDEP)

# implicit rules
.asm.bin:
	nasm -f bin -o $*.bin $*.asm
# Borland MAKE 2.0 does not support redirection
#	ndisasm -o 0x7C00 $*.bin >$*.lst

.c.o:
# Borland MAKE 2.0 does not understand $@ macro
#	tcc $(CFLAGS) -c -o$@ $<
	tcc $(CFLAGS) -c -o$*.o $<

# explicit rules
stage2\loader.bin: stage2\start.asm stage2\boot.o $(MAKEDEP)
	nasm -f obj -o stage2\start.o stage2\start.asm
# TLINK 2.0 doesn't understand "/L" option, so give full path to libc
	tlink $(LFLAGS)/t stage2\start.o stage2\boot.o,stage2\loader.bin,,$(LIBPATH)\cs.lib

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?