You don't have to bother with the "touch foo.c" if you just add blank rules for all your .c files like the one I gave as an example in the previous post.
Also, automatic dependency tracking is a bit ugly, but once you set it up, it should work for all your files, pretty much. Perhaps at some point I'll add that to the KOS Makefile rules...
EDIT: Added in
commit 441060. Basically, if you add a KOS_DEPDIR variable to your Makefile, it'll automatically generate and include the appropriate dependency tracking information. As an example, here's a Makefile that includes everything you'd need (specifically, from CrabEmu):
Code: Select all
# Makefile
# CrabEmu Dreamcast Makefile
# Copyright (C) 2007, 2008, 2009, 2012, 2013 Lawrence Sebald
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
KOS_DEPDIR = .dep
TARGET = crabemu.bin
OBJS = main.o sound.o palmenu.o ../consoles/sms/sms.o ../consoles/sms/smsmem.o \
../consoles/sms/smsvdp.o ../consoles/sms/smsz80.o \
menu.o font.o pvrutils.o ../consoles/sms/93c46.o ../consoles/sms/mappers.o \
../cpu/CrabZ80/CrabZ80.o ../sound/sn76489.o \
../consoles/sms/terebi.o ../consoles/sms/tms9918a.o \
../consoles/sms/smsmem-gg.o ../consoles/sms/mapper-93c46.o \
../consoles/sms/mapper-korean.o ../consoles/sms/mapper-codemasters.o \
../consoles/sms/mapper-sega.o ../consoles/sms/mapper-sg1000.o \
../consoles/sms/cheats.o ../consoles/sms/sdscterminal.o ../utils/list.o \
../utils/minizip/ioapi.o ../utils/minizip/unzip.o ../sound/ym2413.o \
../consoles/sms/mapper-koreanmsx.o ../consoles/sms/mapper-4PAA.o \
../consoles/colecovision/colecovision.o ../consoles/colecovision/colecomem.o \
../consoles/sms/mapper-none.o ../consoles/sms/mapper-janggun.o ../rom.o \
../cpu/Crab6502/Crab6502.o ../consoles/nes/nes.o ../consoles/nes/nesmem.o \
../consoles/nes/nesppu.o ../consoles/nes/mappers/nesmapper0.o \
../consoles/nes/mappers/nesmapper1.o ../sound/nesapu-nosefart.o \
../sound/nes_apu/fds_snd.o ../sound/nes_apu/mmc5_snd.o \
../sound/nes_apu/nes_apu.o ../sound/nes_apu/vrcvisnd.o \
../consoles/nes/mappers/nesmapper2.o ../consoles/nes/mappers/nesmapper3.o \
../consoles/nes/mappers/nesmapper7.o ../consoles/nes/mappers/nesmapper66.o \
../consoles/nes/mappers/nesmapper9.o
KOS_CFLAGS += -I ../consoles/sms -I ../cpu/CrabZ80 -I ../sound -I .. -W \
-I . -DIN_CRABEMU -DCRABZ80_NO_READMAP_FALLBACK \
-I $(KOS_BASE)/kernel/arch/dreamcast/sound -I ../utils -I ../utils/minizip \
-I ../consoles/colecovision -Wno-char-subscripts -std=gnu99 \
-I ../consoles/nes -I ../cpu/Crab6502 -DCRAB6502_NO_READMAP_FALLBACK \
-DCRAB6502_CPU_TYPE_2A03 -I ../sound/nes_apu -DCRAB6502_ZPG_USE_READMAP \
-DCRAB6502_STACK_USE_READMAP
#KOS_CFLAGS += -DDEBUG -DNO_GUI
#KOS_CFLAGS += -DFPS_COUNTER
# Uncomment below to enable YM2413 emulation in the SMS emulation. Be warned,
# that this will probably break things with the frameskip code.
#KOS_CFLAGS += -DCRABEMU_DC_ENABLE_YM2413
all: mkdep rm-elf $(TARGET)
mkdep:
mkdir -p $(KOS_DEPDIR)
clean:
-rm -f $(TARGET) 1ST_READ.BIN crabemu.bin crabemu.elf $(OBJS)
-rm -rf $(KOS_DEPDIR)
rm-elf:
-rm -f $(TARGET) crabemu.elf
crabemu.elf: $(OBJS)
kos-cc -o $@ $^ -lkosext2fs -lpng -lz -lbz2 -lm
crabemu.bin: crabemu.elf
kos-objcopy -O binary -R .stack $^ $@
1ST_READ.BIN: crabemu.bin
scramble $^ $@
include $(KOS_BASE)/Makefile.rules
The relevant stuff in here is the KOS_DEPDIR line (of course), the mkdep target (and the fact that it is in the all target), and the last line of the clean target. The mkdep target simply creates the directory to store the dependency information in (so that you don't have to keep the directory around) and the last line of the clean target gets rid of the directory. Of course, you could just as easily keep around a directory and eliminate the need for that stuff at all.