From 92ac7de6585e64006db631d6c39d4a7ef00f4776 Mon Sep 17 00:00:00 2001 From: Takamichi Horikawa Date: Thu, 26 Jan 2017 22:10:24 +0900 Subject: refactor Makefile and add msvc --- win32/amd64/Makefile | 26 ++++++-------------------- win32/fmplayer.mak | 39 +++++++++++++++++++++++++++++++++++++++ win32/msvc/.gitignore | 2 ++ win32/msvc/GNUmakefile | 30 ++++++++++++++++++++++++++++++ win32/x86/Makefile | 26 ++++++-------------------- 5 files changed, 83 insertions(+), 40 deletions(-) create mode 100644 win32/fmplayer.mak create mode 100644 win32/msvc/.gitignore create mode 100644 win32/msvc/GNUmakefile 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 $@" -- cgit v1.2.3