aboutsummaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authorTakamichi Horikawa <takamichiho@gmail.com>2017-01-26 22:10:24 +0900
committerTakamichi Horikawa <takamichiho@gmail.com>2017-01-26 22:10:24 +0900
commit92ac7de6585e64006db631d6c39d4a7ef00f4776 (patch)
tree9bb2bec4a042a0c18364d9f6f292480e77a6f443 /win32
parentfc1ea6ee5b5135e70e1a0e9b2737f6189b740691 (diff)
refactor Makefile and add msvc
Diffstat (limited to 'win32')
-rw-r--r--win32/amd64/Makefile26
-rw-r--r--win32/fmplayer.mak39
-rw-r--r--win32/msvc/.gitignore2
-rw-r--r--win32/msvc/GNUmakefile30
-rw-r--r--win32/x86/Makefile26
5 files changed, 83 insertions, 40 deletions
diff --git a/win32/amd64/Makefile b/win32/amd64/Makefile
index d25dd7e..5769d7b 100644
--- a/win32/amd64/Makefile
+++ b/win32/amd64/Makefile
@@ -3,35 +3,21 @@ vpath %.c ../../fmdriver
vpath %.c ../../libopna
vpath %.c ../../fmdsp
vpath %.rc ..
-TARGET=fmplayer.exe
-ICON=../fmplayer.ico
-ICONFILES=../fmplayer.png ../fmplayer32.png
-FMDRIVER_OBJS=fmdriver_fmp.o \
- ppz8.o
-LIBOPNA_OBJS=opna.o \
- opnatimer.o \
- opnafm.o \
- opnassg.o \
- opnadrum.o \
- opnaadpcm.o
-FMDSP_OBJS=fmdsp.o font_rom.o
-OBJS=main.o dsoundout.o soundout.o waveout.o uc.o lnf.o winfont.o \
- $(FMDRIVER_OBJS) \
- $(LIBOPNA_OBJS) \
- $(FMDSP_OBJS)
+
+include ../fmplayer.mak
+
+OBJS=$(addsuffix .o,$(OBJBASE) uc $(RESBASE))
ARCH=x86_64
PREFIX=$(ARCH)-w64-mingw32-
CC=$(PREFIX)gcc
WINDRES=$(PREFIX)windres
STRIP=$(PREFIX)strip
CFLAGS=-std=c99 -Os -Wall -Wextra -pedantic -I../.. \
- -DUNICODE -D_UNICODE \
- -DWINVER=0x0500 -D_WIN32_WINNT=0x0500
+ $(addprefix -D,$(DEFINES))
LIBS=-nostdlib -s -Wl,-eentry \
-Wl,--subsystem,windows \
-lgcc -lntdll \
- -luser32 -lkernel32 -lole32 -ldxguid -luuid -lcomdlg32 \
- -lgdi32 -lshlwapi -lwinmm -lshell32
+ $(addprefix -l,$(LIBBASE))
$(TARGET): $(OBJS)
@echo " CCLD $@"
diff --git a/win32/fmplayer.mak b/win32/fmplayer.mak
new file mode 100644
index 0000000..146b5b8
--- /dev/null
+++ b/win32/fmplayer.mak
@@ -0,0 +1,39 @@
+TARGET=fmplayer.exe
+
+ICON=../fmplayer.ico
+ICONFILES=../fmplayer.png ../fmplayer32.png
+
+DEFINES=UNICODE _UNICODE \
+ WINVER=0x0500 _WIN32_WINNT=0x0500 \
+ DIRECTSOUND_VERSION=0x0800
+
+FMDRIVER_OBJS=fmdriver_fmp \
+ ppz8
+LIBOPNA_OBJS=opna \
+ opnatimer \
+ opnafm \
+ opnassg \
+ opnadrum \
+ opnaadpcm
+FMDSP_OBJS=fmdsp \
+ font_rom
+OBJBASE=main \
+ soundout \
+ dsoundout \
+ waveout \
+ winfont \
+ $(FMDRIVER_OBJS) \
+ $(LIBOPNA_OBJS) \
+ $(FMDSP_OBJS)
+RESBASE=lnf
+LIBBASE=user32 \
+ kernel32 \
+ ole32 \
+ dxguid \
+ uuid \
+ comdlg32 \
+ gdi32 \
+ shlwapi \
+ winmm \
+ shell32
+
diff --git a/win32/msvc/.gitignore b/win32/msvc/.gitignore
new file mode 100644
index 0000000..a1903dc
--- /dev/null
+++ b/win32/msvc/.gitignore
@@ -0,0 +1,2 @@
+*.obj
+*.res
diff --git a/win32/msvc/GNUmakefile b/win32/msvc/GNUmakefile
new file mode 100644
index 0000000..734326c
--- /dev/null
+++ b/win32/msvc/GNUmakefile
@@ -0,0 +1,30 @@
+vpath %.c ../
+vpath %.c ../../fmdriver
+vpath %.c ../../libopna
+vpath %.c ../../fmdsp
+vpath %.rc ..
+
+include ../fmplayer.mak
+
+OBJS=$(addsuffix .obj,$(OBJBASE)) $(addsuffix .res,$(RESBASE))
+CC=cl /nologo
+RC=rc /nologo
+CFLAGS=/W2 /Os /Oi /MT /I..\.. \
+ $(addprefix /D,$(DEFINES))
+LIBS=$(addsuffix .lib,$(LIBBASE)) \
+ /link /SUBSYSTEM:WINDOWS
+
+$(TARGET): $(OBJS)
+ @echo CCLD $@
+ @$(CC) $(LDFLAGS) /Fe$@ $(OBJS) $(LIBS)
+
+%.obj: %.c
+ @echo CC $@
+ @$(CC) $(CFLAGS) /c $< /Fo$@
+
+%.res: %.rc $(ICON)
+ @echo RC $@
+ @$(RC) /fo$@ $<
+
+clean:
+ -del $(TARGET) $(OBJS)
diff --git a/win32/x86/Makefile b/win32/x86/Makefile
index 8e16579..752db91 100644
--- a/win32/x86/Makefile
+++ b/win32/x86/Makefile
@@ -3,36 +3,22 @@ vpath %.c ../../fmdriver
vpath %.c ../../libopna
vpath %.c ../../fmdsp
vpath %.rc ..
-TARGET=fmplayer.exe
-ICON=../fmplayer.ico
-ICONFILES=../fmplayer.png ../fmplayer32.png
-FMDRIVER_OBJS=fmdriver_fmp.o \
- ppz8.o
-LIBOPNA_OBJS=opna.o \
- opnatimer.o \
- opnafm.o \
- opnassg.o \
- opnadrum.o \
- opnaadpcm.o
-FMDSP_OBJS=fmdsp.o font_rom.o
-OBJS=main.o dsoundout.o soundout.o waveout.o uc.o lnf.o winfont.o \
- $(FMDRIVER_OBJS) \
- $(LIBOPNA_OBJS) \
- $(FMDSP_OBJS)
+
+include ../fmplayer.mak
+
+OBJS=$(addsuffix .o,$(OBJBASE) uc $(RESBASE))
ARCH=i686
PREFIX=$(ARCH)-w64-mingw32-
CC=$(PREFIX)gcc
WINDRES=$(PREFIX)windres
STRIP=$(PREFIX)strip
CFLAGS=-std=c99 -Os -Wall -Wextra -pedantic -I../.. \
- -DUNICODE -D_UNICODE \
- -DWINVER=0x0500 -D_WIN32_WINNT=0x0500 \
+ $(addprefix -D,$(DEFINES)) \
-march=i586
LIBS=-nostdlib -s -Wl,-e_entry@4 \
-Wl,--subsystem,windows \
-lgcc -lntdll \
- -luser32 -lkernel32 -lole32 -ldxguid -luuid -lcomdlg32 \
- -lgdi32 -lshlwapi -lwinmm -lshell32
+ $(addprefix -l,$(LIBBASE))
$(TARGET): $(OBJS)
@echo " CCLD $@"