diff --git a/Makefile.linux b/Makefile.linux index d5f8aea782..4b26b22e9d 100644 --- a/Makefile.linux +++ b/Makefile.linux @@ -3,9 +3,13 @@ CXX ?= g++ CC ?= gcc NASM ?= nasm ifndef DEBUG -CFLAGS ?= -pipe -Wall -Wno-unused -O2 -fomit-frame-pointer -ffunction-sections -fvtable-gc -fno-rtti + ifndef NOGC + CFLAGS ?= -pipe -Wall -Wno-unused -O2 -fomit-frame-pointer -ffunction-sections -fvtable-gc -fno-rtti + else + CFLAGS ?= -pipe -Wall -Wno-unused -O2 -fomit-frame-pointer -ffunction-sections -fno-rtti + endif else -CFLAGS ?= -pipe -Wall -Wno-unused + CFLAGS ?= -pipe -Wall -Wno-unused endif CFLAGS += -DHAVE_FILELENGTH -D__forceinline=inline -Izlib -IFLAC `sdl-config --cflags` CFLAGS += -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -DNEED_STRUPR @@ -38,7 +42,11 @@ ZDOOMDEBUG = zdoomd ifndef DEBUG OBJDIR = $(RELEASEOBJ) CFLAGS += -DNDEBUG - LDFLAGS += -s -Wl,--gc-sections,-Map=$(ZDOOM).map + ifndef NOGC + LDFLAGS += -s -Wl,--gc-sections,-Map=$(ZDOOM).map + else + LDFLAGS += -s -Wl,-Map=$(ZDOOM).map + endif ZDOOMBIN = $(ZDOOM) else OBJDIR = $(DEBUGOBJ) diff --git a/tools/dehsupp/Makefile b/tools/dehsupp/Makefile index cd4b2ed963..f39d17b94a 100644 --- a/tools/dehsupp/Makefile +++ b/tools/dehsupp/Makefile @@ -4,11 +4,12 @@ ifeq (Windows_NT,$(OS)) CFLAGS = $(LOC) -Os -Wall -fomit-frame-pointer else EXE = dehsupp - CCDV = + CCDV = CFLAGS = -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -Os -Wall -fomit-frame-pointer endif CC = gcc +LDFLAGS = -s RE2C = ../re2c/re2c LEMON = ../lemon/lemon @@ -20,7 +21,7 @@ OBJS = dehsupp.o parse.o scanner.o all: $(EXE) $(EXE): $(OBJS) - $(CCDV) $(CC) -o $(EXE) $(OBJS) + $(CCDV) $(CC) $(LDFLAGS) -o $(EXE) $(OBJS) .PHONY: clean diff --git a/tools/lemon/Makefile b/tools/lemon/Makefile new file mode 100644 index 0000000000..2f81b77c4a --- /dev/null +++ b/tools/lemon/Makefile @@ -0,0 +1,36 @@ +ifeq (Windows_NT,$(OS)) + EXE = lemon.exe + CCDV = @../../ccdv + CFLAGS = $(LOC) -D_WIN32 -Os -Wall -Wno-implicit -fomit-frame-pointer +else + EXE = lemon + CCDV = + CFLAGS = -Os -Wall -Wno-implicit -fomit-frame-pointer +endif + +CC = gcc +LDFLAGS = -s + +OBJS = lemon.o + +all: $(EXE) + +$(EXE): $(OBJS) + $(CCDV) $(CC) $(LDFLAGS) -o $(EXE) $(OBJS) + +%.o: %.c + $(CCDV) $(CC) $(CFLAGS) -c -o $@ $< + +.PHONY: clean + +clean: +ifeq (Windows_NT,$(OS)) + -del /q /f $(EXE) 2>nul + -del /q /f *.o 2>nul +else + rm -f $(EXE) + rm -f *.o +endif + +lemon.o: lemon.c lempar.c + diff --git a/tools/lemon/Makefile.mgw b/tools/lemon/Makefile.mgw deleted file mode 100644 index ff3be94740..0000000000 --- a/tools/lemon/Makefile.mgw +++ /dev/null @@ -1,23 +0,0 @@ -EXE = lemon.exe - -CCDV = @../../ccdv -CC = gcc -CFLAGS = $(LOC) -D_WIN32 -Os -Wall -Wno-implicit -fomit-frame-pointer - -OBJS = lemon.o - -all: $(EXE) - -.c.o: - $(CCDV) $(CC) $(CFLAGS) -c -o $@ $< - -$(EXE): $(OBJS) - $(CCDV) $(CC) -o $(EXE) $(OBJS) - -.PHONY: clean - -clean: - -del /q /f $(EXE) 2>nul - -del /q /f *.o 2>nul - -lemon.o: lemon.c lempar.c diff --git a/tools/makewad/Makefile b/tools/makewad/Makefile index 145831cb80..63e62adad2 100644 --- a/tools/makewad/Makefile +++ b/tools/makewad/Makefile @@ -2,13 +2,13 @@ ifeq (Windows_NT,$(OS)) EXE = makewad.exe CCDV = @../../ccdv CFLAGS = -Os -Wall -fomit-frame-pointer - LDFLAGS = -L../../zlib/ -lz + LDFLAGS = -s -L../../zlib/ -lz ZLIB = ../../zlib/libz.a else EXE = makewad CCDV = CFLAGS = -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -Os -Wall -fomit-frame-pointer - LDFLAGS = -lz + LDFLAGS = -s -lz ZLIB = endif diff --git a/tools/re2c/Makefile.mgw b/tools/re2c/Makefile similarity index 57% rename from tools/re2c/Makefile.mgw rename to tools/re2c/Makefile index f8f150adcc..ee5b950c79 100644 --- a/tools/re2c/Makefile.mgw +++ b/tools/re2c/Makefile @@ -1,8 +1,15 @@ -EXE = re2c.exe +ifeq (Windows_NT,$(OS)) + EXE = re2c.exe + CCDV = @../../ccdv + CXXFLAGS = $(LOC) -D_WIN32 -DNDEBUG -Os -Wall -Wno-unused +else + EXE = re2c + CCDV = + CXXFLAGS = -DHAVE_CONFIG_H -DNDEBUG -Os -Wall -Wno-unused +endif -CCDV = @../../ccdv CXX = g++ -CXXFLAGS = $(LOC) -D_WIN32 -DNDEBUG -Os -Wall -Wno-unused +LDFLAGS= -s OBJS = actions.o code.o dfa.o main.o mbo_getopt.o parser.o scanner.o substr.o translate.o @@ -12,13 +19,18 @@ all: $(EXE) $(CCDV) $(CXX) $(CXXFLAGS) -c -o $@ $< $(EXE): $(OBJS) - $(CCDV) $(CXX) -s -o $(EXE) $(OBJS) + $(CCDV) $(CXX) $(LDFLAGS) -o $(EXE) $(OBJS) .PHONY: clean clean: +ifeq (Windows_NT,$(OS)) -del /q /f $(EXE) 2>nul -del /q /f *.o 2>nul +else + rm -f $(EXE) + rm -f *.o +endif actions.o: actions.cc code.o: code.cc diff --git a/tools/xlatcc/Makefile b/tools/xlatcc/Makefile index fb3b2a6f61..27bb00d1be 100644 --- a/tools/xlatcc/Makefile +++ b/tools/xlatcc/Makefile @@ -4,11 +4,12 @@ ifeq (Windows_NT,$(OS)) CFLAGS = $(LOC) -Os -Wall -fomit-frame-pointer else EXE = xlatcc - CCDV = + CCDV = CFLAGS = -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp $(LOC) -Os -Wall -fomit-frame-pointer endif CC = gcc +LDFLAGS= -s BISON = bison BISONFLAGS = @@ -18,7 +19,7 @@ OBJS = gen.o xlat-parse.tab.o all: $(EXE) $(EXE): $(OBJS) - $(CCDV) $(CC) -o $(EXE) $(OBJS) + $(CCDV) $(CC) $(LDFLAGS) -o $(EXE) $(OBJS) .PHONY: clean