1#
2# nosefart makefile
3#
4# $Id: Makenose.dos,v 1.1 2003/04/08 20:46:46 ben Exp $
5
6NSF_EXE = nosefart.exe
7NSF_DEP = _nsfdep
8
9# uncomment to build a debug version
10DEBUG = 1
11
12
13ifdef DEBUG
14# debug version
15DEBUGFLAGS = -DOSD_LOG -DNOFRENDO_DEBUG -DNES6502_DEBUG
16OPTFLAGS =
17else
18# release version
19DEBUGFLAGS =
20OPTFLAGS = -O3 -fomit-frame-pointer -fno-exceptions
21endif
22
23
24BUILDFLAGS = -DDJGPP_USE_NEARPTR -DNSF_PLAYER
25WARNFLAGS = -W -Wall -Werror -Wno-unused
26CFLAGS = -Isrc -Isrc/msdos -Isrc/sndhrdw -Isrc/machine -Isrc/cpu/nes6502 -march=i586 \
27	-ffast-math $(OPTFLAGS) $(WARNFLAGS) $(BUILDFLAGS) $(DEBUGFLAGS)
28LFLAGS =
29
30COREOBJ	= nsfobj/log.o nsfobj/memguard.o
31CPUOBJ	= nsfobj/cpu/nes6502/nes6502.o nsfobj/cpu/nes6502/dis6502.o
32MACHOBJ	= nsfobj/machine/nsf.o
33SNDOBJ	= nsfobj/sndhrdw/nes_apu.o nsfobj/sndhrdw/vrcvisnd.o nsfobj/sndhrdw/fmopl.o \
34	nsfobj/sndhrdw/vrc7_snd.o nsfobj/sndhrdw/mmc5_snd.o nsfobj/sndhrdw/fds_snd.o
35
36DOSOBJ	= nsfobj/msdos/dos_sb.o nsfobj/msdos/dostimer.o nsfobj/msdos/hercules.o \
37	nsfobj/msdos/main_dos.o
38
39NSF_OBJ	= $(COREOBJ) $(CPUOBJ) $(MACHOBJ) $(SNDOBJ) $(DOSOBJ)
40NSF_SRC	= $(subst nsfobj,src,$(NSF_OBJ:.o=.c))
41
42
43#
44# make rules
45#
46
47# check to see if we need to build the obj tree
48ifeq ($(wildcard ./nsfobj),)
49noobj: maketree all
50endif
51
52all:	default
53
54default: $(NSF_EXE)
55
56$(NSF_EXE): $(NSF_OBJ) Makenose.dos $(NSF_DEP)
57	$(CC) $(LFLAGS) -o $(NSF_EXE) $(NSF_OBJ) $(LIBS)
58
59#
60# phony targets
61#
62
63.PHONY: clean
64clean:
65	deltree /Y nsfobj
66	rm -f $(NSF_DEP) $(NSF_EXE) errorlog.txt
67
68.PHONY: realclean
69realclean: clean
70	rm -f *.opt *.ncb
71
72# for visual C++
73.PHONY: rebuildall
74rebuildall: clean maketree depend $(NSF_EXE)
75
76# build the dependency data
77.PHONY: depend
78$(NSF_DEP):
79	$(CC) $(CFLAGS) -MM $(NSF_SRC) > $(NSF_DEP)
80
81depend:
82	$(CC) $(CFLAGS) -MM $(NSF_SRC) > $(NSF_DEP)
83
84nsfobj/%.o: src/%.c
85	$(CC) $(CFLAGS) -c $< -o $@
86
87maketree:
88	md nsfobj
89	md nsfobj\cpu
90	md nsfobj\cpu\nes6502
91	md nsfobj\machine
92	md nsfobj\sndhrdw
93	md nsfobj\msdos
94
95# Dependency data
96include $(NSF_DEP)
97
98# $Log: Makenose.dos,v $
99# Revision 1.1  2003/04/08 20:46:46  ben
100# add new input for NES music file.
101#
102# Revision 1.3  2000/06/26 04:54:10  matt
103# udpated to automatically generate dependencies
104#
105# Revision 1.2  2000/06/19 23:59:33  matt
106# added MMC5/FDS/VRC7
107#
108# Revision 1.1  2000/06/12 01:16:22  matt
109# initial revision
110#