forked from FDOS/kernel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
148 lines (131 loc) · 3.47 KB
/
makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# What you WANT on DOS is:
# EDIT CONFIG.B, COPY CONFIG.B to CONFIG.BAT, RUN BUILD.BAT
# On Linux, use config.mak, and "make all", "make clean", or "make clobber"
# On Windows, use config.mak, and
# "mingw32-make all", "mingw32-make clean", or "mingw32-make clobber"
default:
@echo On DOS, please type build, clean, or clobber.
@echo On Linux, please type make all, make clean, or make clobber.
@echo On Windows, please type mingw32-make all, mingw32-make clean, or
@echo mingw32-make clobber.
build:
build
bin\kwc8616.sys:
build -r wc 86 fat16
bin\kwc8632.sys:
build -r wc 86 fat32
# use as follows: wmake -ms zip VERSION=2029
zip_src:
cd ..\..
zip -9 -r -k source/ke$(VERSION)s.zip source/ke$(VERSION) -i@source/ke$(VERSION)/filelist
cd source\ke$(VERSION)
BINLIST1 = doc bin/kernel.sys bin/sys.com
# removed - as the 2nd zip -r line to add those to the zip:
# BINLIST2 = bin/config.sys bin/autoexec.bat bin/command.com bin/install.bat
zipfat16: bin\kwc8616.sys
mkdir doc
mkdir doc\kernel
copy docs\*.txt doc\kernel
copy docs\*.cvs doc\kernel
copy docs\copying doc\kernel
copy docs\*.lsm doc\kernel
del doc\kernel\build.txt
del doc\kernel\lfnapi.txt
copy bin\kwc8616.sys bin\kernel.sys
zip -r -k ../ke$(VERSION)16.zip $(BINLIST)
utils\rmfiles doc\kernel\*.txt doc\kernel\*.cvs doc\kernel\*.lsm doc\kernel\copying
rmdir doc\kernel
rmdir doc
zipfat32: bin\kwc8632.sys
mkdir doc
mkdir doc\kernel
copy docs\*.txt doc\kernel
copy docs\*.cvs doc\kernel
copy docs\copying doc\kernel
copy docs\*.lsm doc\kernel
del doc\kernel\build.txt
del doc\kernel\lfnapi.txt
copy bin\kwc8632.sys bin\kernel.sys
zip -r -k ../ke$(VERSION)32.zip $(BINLIST)
utils\rmfiles doc\kernel\*.txt doc\kernel\*.cvs doc\kernel\*.lsm doc\kernel\copying
rmdir doc\kernel
rmdir doc
zip: zip_src zipfat16 zipfat32
#Linux part
#defaults: override using config.mak
export
ifeq ($(OS),Windows_NT)
BUILDENV ?= windows
DIRSEP=\
CP=copy
else
BUILDENV ?= linux
DIRSEP=/
CP=cp
endif
ifeq ($(BUILDENV),windows)
COMPILER=owwin
TEST_F=type >nul 2>nul
TOUCH=wtouch
else
COMPILER=owlinux
TEST_F=test -f
TOUCH=touch
ifndef WATCOM
WATCOM=$(HOME)/watcom
PATH:=$(WATCOM)/binl:$(PATH)
endif
endif
XCPU=86
XFAT=32
XUPX=upx --8086 --best
XNASM=nasm
ifeq ($(COMPILER),gcc)
MAKE=make
MAKEADJUST=for i in utils lib drivers boot sys kernel setver; do sed 's@!include "\(.*\)"@include ../mkfiles/gcc.mak@' < $$i/makefile > $$i/GNUmakefile; done
MAKEREMOVE=for i in utils lib drivers boot sys kernel setver; do rm -f $$i/GNUmakefile; done
XLINK=ia16-elf-gcc
else
MAKE=wmake -ms -h
MAKEADJUST=
MAKEREMOVE=
XLINK=wlink
endif
#ALLCFLAGS=-DDEBUG
-include config.mak
ifdef XUPX
UPXOPT=-U
endif
all:
$(MAKEADJUST)
cd utils && $(MAKE) production
cd lib && ( $(TEST_F) libm.lib || $(TOUCH) libm.lib )
cd drivers && $(MAKE) production
cd boot && $(MAKE) production
cd sys && $(MAKE) production
cd kernel && $(MAKE) production
cd country && $(MAKE) DIRSEP=$(DIRSEP) CP=$(CP) production
cd setver && $(MAKE) production
$(MAKEREMOVE)
clean:
$(MAKEADJUST)
cd utils && $(MAKE) clean
cd lib && $(MAKE) clean
cd drivers && $(MAKE) clean
cd boot && $(MAKE) clean
cd sys && $(MAKE) clean
cd kernel && $(MAKE) clean
cd country && $(MAKE) clean
cd setver && $(MAKE) clean
$(MAKEREMOVE)
clobber:
$(MAKEADJUST)
cd utils && $(MAKE) clobber
cd lib && $(MAKE) clobber
cd drivers && $(MAKE) clobber
cd boot && $(MAKE) clobber
cd sys && $(MAKE) clobber
cd kernel && $(MAKE) clobber
cd country && $(MAKE) clobber
cd setver && $(MAKE) clobber
$(MAKEREMOVE)