-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
68 lines (53 loc) · 1.75 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
# Makefile
srcroot = .
include make.inc
# directories that produce binaries
SUBSYSTEMS = kernel testmod
SUBDIRS = $(SUBSYSTEMS) bin
SUBDIRS_SETUP := $(foreach subdir,$(SUBDIRS),$(subdir).setup)
SUBDIRS_CLEAN := $(foreach subdir,$(SUBDIRS),$(subdir).clean)
.PHONY: all
all: bin
.PHONY: $(SUBSYSTEMS)
$(SUBSYSTEMS): setup
$(MAKE) -C $@
.PHONY: bin
bin: $(SUBSYSTEMS)
$(MAKE) -C bin
.PHONY: setup
setup: $(SUBDIRS_SETUP) include/version.h
.PHONY: $(SUBDIRS_SETUP)
$(SUBDIRS_SETUP):
$(MAKE) -C $(basename $@) setup
.PHONY: clean
clean: $(SUBDIRS_CLEAN)
rm -f bochs.out include/version.h hardcopy.ps
.PHONY: $(SUBDIRS_CLEAN)
$(SUBDIRS_CLEAN):
$(MAKE) -C $(basename $@) clean
.PHONY: include/version.h
include/version.h:
@echo "#ifndef _VERSION_H_" > include/version.h
@echo "#define _VERSION_H_" >> include/version.h
@echo "#define SPECK_VERSION \"${VERSION}\"" >> include/version.h
@echo "#define SPECK_ARCH \"$(arch)\"" >> include/version.h
@echo "#define SPECK_BUILD_DATE \"$(shell date)\"" >> include/version.h
@echo "#define SPECK_BUILD_USER \"$(shell whoami)\"" >> include/version.h
ifeq ($(shell uname),Linux)
@echo "#define SPECK_BUILD_HOST \"$(shell hostname --fqdn)\"" >> include/version.h
else
@echo "#define SPECK_BUILD_HOST \"$(shell hostname)\"" >> include/version.h
endif
@echo "#endif" >> include/version.h
.PHONY: winbochs
winbochs:
ifeq ($(wildcard /bin/cygwin1.dll),/bin/cygwin1.dll)
(cd bin/i386/win32; "C:/Program Files/bochs/bochs.exe")
else
@echo You are not running cygwin. On a Unix box, set up your .bochsrc
@echo to point to bin/i386/floppy.img and run bochs.
endif
.PHONY: hardcopy
hardcopy:
enscript -r -2 -E --color -o hardcopy.ps `find . -name '*.[chS]' -o -name \
'.asm' -o -name 'Makefile' -o -name 'make.inc' | grep -v '.svn'`