Improve the Makefiles
This commit is contained in:
parent
f6e5f94ab4
commit
32dc0ed9a3
2 changed files with 17 additions and 10 deletions
|
@ -1,5 +1,3 @@
|
|||
BUILDDIR = Build
|
||||
|
||||
CC = cc
|
||||
PY = python2
|
||||
NASM = nasm
|
||||
|
@ -8,11 +6,14 @@ QEMU = qemu-system-i386
|
|||
CCFLAGS =
|
||||
ASFLAGS =
|
||||
|
||||
MUSIC = Data/Song/nyan.mid
|
||||
|
||||
# Don't change the build directory, it is hardcoded on other places
|
||||
BUILDDIR = Build
|
||||
|
||||
FRAMES = $(sort $(wildcard Data/Image/Frames/*.png))
|
||||
SPECIAL = $(sort $(wildcard Data/Image/Special/*.png))
|
||||
|
||||
MUSIC = Data/Song/nyan.mid
|
||||
|
||||
STAGE1ASM = $(wildcard Source/Stage1/*.asm)
|
||||
STAGE2ASM = $(shell find Source/Stage2 -name *.asm -type f)
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
CC = i686-w64-mingw32-gcc
|
||||
PYTHON = python2
|
||||
|
||||
CCFLAGS = -nostdlib -nodefaultlibs -std=c99 -Wl,-e_start -s -mwindows -m32 -municode -Os -w
|
||||
CCFLAGS = -nostdlib -nodefaultlibs -std=c99 -Wl,-e_start -s -mwindows -m32 -municode -Os -w -march=i486
|
||||
LIBS = -luser32 -lkernel32 -lgdi32 -lwinmm -lcomctl32 -ladvapi32 -lshell32 -lpsapi
|
||||
|
||||
# Don't change the build directory, it is hardcoded on other places
|
||||
|
@ -12,13 +12,14 @@ HFILES = $(shell find Source -name '*.h' -type f)
|
|||
|
||||
DATA = $(wildcard Data/*)
|
||||
|
||||
all: $(BUILDDIR)/MEMZ-Clean.bat $(BUILDDIR)/MEMZ-Destructive.bat
|
||||
|
||||
all: dir $(BUILDDIR)/MEMZ-Clean.bat $(BUILDDIR)/MEMZ-Destructive.bat
|
||||
|
||||
dir: $(BUILDDIR)
|
||||
|
||||
$(BUILDDIR):
|
||||
mkdir -p $(BUILDDIR)
|
||||
|
||||
|
||||
$(BUILDDIR)/Data.c $(BUILDDIR)/Data.h: ../NyanMBR/disk.img $(DATA)
|
||||
$(PYTHON) Data/genData.py $(BUILDDIR)/Data.c $(BUILDDIR)/Data.h
|
||||
|
||||
|
@ -26,17 +27,22 @@ $(BUILDDIR)/MEMZ-Clean.exe: $(CFILES) $(HFILES) $(BUILDDIR)/Data.c $(BUILDDIR)/D
|
|||
echo "#define CLEAN" > $(BUILDDIR)/Mode.h
|
||||
$(CC) $(CCFLAGS) $(CFILES) $(BUILDDIR)/Data.c $(LIBS) -o $@
|
||||
|
||||
$(BUILDDIR)/MEMZ-Clean.bat: dir $(BUILDDIR)/MEMZ-Clean.exe Source/exe2bat.py
|
||||
$(BUILDDIR)/MEMZ-Clean.bat: $(BUILDDIR)/MEMZ-Clean.exe Source/exe2bat.py
|
||||
$(PYTHON) Source/exe2bat.py $(BUILDDIR)/MEMZ-Clean.exe $@ MEMZ-Clean.exe -zip
|
||||
|
||||
$(BUILDDIR)/MEMZ-Destructive.exe: $(CFILES) $(HFILES) $(BUILDDIR)/Data.c $(BUILDDIR)/Data.h
|
||||
echo "#define DESTRUCTIVE" > $(BUILDDIR)/Mode.h
|
||||
$(CC) $(CCFLAGS) $(CFILES) $(BUILDDIR)/Data.c $(LIBS) -o $@
|
||||
|
||||
$(BUILDDIR)/MEMZ-Destructive.bat: dir $(BUILDDIR)/MEMZ-Destructive.exe Source/exe2bat.py
|
||||
$(BUILDDIR)/MEMZ-Destructive.bat: $(BUILDDIR)/MEMZ-Destructive.exe Source/exe2bat.py
|
||||
$(PYTHON) Source/exe2bat.py $(BUILDDIR)/MEMZ-Destructive.exe $@ MEMZ-Destructive.exe -zip
|
||||
|
||||
clean:
|
||||
rm -r $(BUILDDIR)
|
||||
|
||||
.PHONY: clean all dir
|
||||
clean-exe: dir $(BUILDDIR)/MEMZ-Clean.exe
|
||||
clean-bat: dir $(BUILDDIR)/MEMZ-Clean.bat
|
||||
destructive-exe: dir $(BUILDDIR)/MEMZ-Destructive.exe
|
||||
destructive-bat: dir $(BUILDDIR)/MEMZ-Destructive.bat
|
||||
|
||||
.PHONY: clean all dir clean-exe clean-bat destructive-exe destructive-bat
|
Reference in a new issue