-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile.sub
More file actions
119 lines (93 loc) · 3.78 KB
/
Makefile.sub
File metadata and controls
119 lines (93 loc) · 3.78 KB
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
## ========================================================================================================
## IMPORTANT NOTE: This Makefile setup is designed to work both standalone and integrated with brickOS-bibo
## - Makefile: For building stand-alone, effectively providing what would provided by Makefle
## or Makefile.common from brickOS-bibo
## - Makefile.sub: Facilitates building as part of brickOS-bibo
## ========================================================================================================
# Development Packages:
# * Required: GNU GCC, h8300 toolchain
# * Optional: ALSA, SDL
# Runtime Packages Required: TK, TCL Libs, and ALSA or SDL
# * openSUSE: tk
# If defined, EMUSUBDIR _MUST_ include the trailing directory slash
EMUSUBDIR?=
ifeq ($(SOUND),mute)
$(info SOUND Library Target: Muted (requested via value of SOUND))
EMU_SOUND_SOURCE_FILES=sound_none.c
else ifneq ($(shell which sdl-config 2>/dev/null),)
# SDL depends on ALSA, so if the ALSA check is first, SDL will never be selected
$(info SOUND Library Target: SDL (Simple DirectMedia Layer))
# use default SDL config arguments
CFLAGS += $(shell sdl-config --cflags)
LIBS += $(shell sdl-config --libs)
# use custom SDL config arguments (e.g. for building in Cygwin)
#CFLAGS += -I/usr/local/include/SDL
#LIBS += -L/usr/local/lib -lSDL
EMU_SOUND_SOURCE_FILES=sound_sdl.c
else ifeq ($(shell test -d /usr/include/alsa && echo 1),1)
$(info SOUND Library Target: ALSA (Advanced Linux Sound Architecture))
LIBS += -L/usr/lib -lasound
EMU_SOUND_SOURCE_FILES=sound_alsa.c
else
$(info SOUND Library Target: None (no compatible libraries found))
EMU_SOUND_SOURCE_FILES=sound_none.c
endif
EMU_SOUND_SOURCE_PATHS=$(EMU_SOUND_SOURCE_FILES:%=$(EMUSUBDIR)%)
## NOTE: Assembly sources do not work with current compiler tools,
## so disabling EMU_ASM_SOURCE_FILES for now by commenting out the line below.
#MACHINE:=$(shell uname -m)
ifeq ($(MACHINE),x86_64)
EMU_ASM_SOURCE_FILES=h8300-x86-64.S
else
ifneq ($(filter i%86,$(MACHINE)),)
EMU_ASM_SOURCE_FILES=h8300-i586.S
else
ifneq ($(filter sun4%,$(MACHINE)),)
EMU_ASM_SOURCE_FILES=h8300-sparc.S
LIBS += -lsocket
endif
endif
endif
ifneq ($(EMU_ASM_SOURCE_FILES),)
CFLAGS += -DHAVE_RUN_CPU_ASM
endif
EMU_ASM_SOURCE_PATHS=$(EMU_ASM_SOURCE_FILES:%=$(EMUSUBDIR)%)
EMU_SOURCE_FILES=main.c h8300.c peripherals.c memory.c lcd.c timer16.c timer8.c \
buttons.c waitstate.c frame.c serial.c debugger.c adsensors.c \
watchdog.c firmware.c coff.c srec.c socket.c motor.c symbols.c \
lx.c hash.c savefile.c printf.c brickos.c bibo.c
EMU_SOURCE_PATHS=$(EMU_SOURCE_FILES:%=$(EMUSUBDIR)%)
EMU_HEADER_FILES=types.h h8300.h peripherals.h memory.h lx.h symbols.h hash.h \
frame.h debugger.h socket.h coff.h
EMU_HEADER_PATHS=$(EMU_HEADER_FILES:%=$(EMUSUBDIR)%)
EMU_OBJS = $(subst .c,.o,$(EMU_SOURCE_PATHS)) $(subst .S,.o,$(EMU_ASM_SOURCE_PATHS)) \
$(subst .c,.o,$(EMU_SOUND_SOURCE_PATHS))
DIST_ASM_SOURCES=h8300-i586.S h8300-x86-64.S h8300-sparc.S
DIST = README Makefile \
$(SOURCES) $(DIST_ASM_SOURCES) $(HEADERS) \
sound_alsa.c sound_sdl.c sound_none.c \
$(ROM_SOURCES) \
h8300.pl h8300-i586.pl h8300-x86-64.pl h8300-sparc.pl \
ir-server.c GUI.tcl remote \
firmdl.diff dll-src.diff Makefile.diff \
brickemu.dxy
emu: CFLAGS += $(PROFILE)
emu: $(EMU_OBJS)
$(CC) $(CFLAGS) $^ $(LIBS) -lz -o $@
emu-clean:
rm -f *.o *.inc
rm -f -r html latex
emu-realclean: emu-clean
rm -f emu
emu-install:
emu-uninstall:
# Empty target to see how the sound library check evaluates
check-sound-lib:
h83%.inc: h83%.pl
perl $^ > $@
h8300.o: h8300.inc h8300.h
h8300-i586.o: h8300-i586.inc
h8300-x86-64.o: h8300-x86-64.inc
h8300-sparc.o: h8300-sparc.inc
lcd.o: h8300.h
.PHONY: all clean realclean emu-clean emu-realclean emu-install emu-uninstall