makefile

来自「一个RPG术语查询器」· 代码 · 共 84 行

TXT
84
字号
# Makefile

.PHONY: all clean error

ifndef UNIX
ifndef MINGW
ifndef DJGPP
error:
	@echo To build, please run 'make [platform]=1', where [platform] can be
	@echo DJGPP, MINGW, or UNIX.
endif
endif
endif

ifdef DJGPP
CC = gxx
else
CC = g++
endif

ifdef DEBUGMODE
CFLAGS = -DDEBUGMODE -g3 -Wall -W -Werror
ifdef UNIX
LDFLAGS = `allegro-config --libs debug`
else
LDFLAGS = -lalld
endif
else
CFLAGS = -Wall -W -O3 -fomit-frame-pointer -ffast-math
ifdef UNIX
LDFLAGS = `allegro-config --libs` -s
else
LDFLAGS = -lalleg -s
endif
endif

ifdef MINGW
LDFLAGS += -Wl,--subsystem=windows
else
ifdef NOCONSOLE
LDFLAGS += -Wl,--subsystem=windows
endif
endif

ifndef CPU_TYPE
ifdef DJGPP
CPU_TYPE = pentium
else
ifdef MINGW
CPU_TYPE = pentium
endif
endif
endif

ifdef CPU_TYPE
ifdef DEBUGMODE
CFLAGS += -mcpu=$(CPU_TYPE)
else
CFLAGS += -march=$(CPU_TYPE)
endif
endif

SRCS = $(wildcard source/*.cpp)
OBJFILES = $(SRCS:source/.cpp=.o)

ifdef UNIX
PROGNAME = grpg
else
PROGNAME = grpg.exe
endif

all: $(OBJFILES)
	$(CC) -o $(PROGNAME) $(OBJFILES) $(LDFLAGS)

%.o: %.cpp
	$(CC) $(CFLAGS) -o $@ -c $<

clean:
	rm *.o

veryclean:
	rm *.o
	rm $(PROGNAME)

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?