Skip to content

Commit e602739

Browse files
committed
halved binary size by using nostdlib
1 parent cb91e06 commit e602739

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11

22
SRCS=virgo.c
33
OBJS=$(SRCS:.c=.o)
4-
CFLAGS=-O2 -std=c99 -Wall -fno-ident -ffunction-sections -fdata-sections
5-
LDFLAGS=-static -s -lgdi32 -Wl,-subsystem,windows,--gc-sections
4+
CFLAGS=-O2 -nostdlib -Wall -fno-ident -ffunction-sections -fdata-sections -DRELEASE=1
5+
LIBS=-luser32 -lshell32 -lmsvcrt -lkernel32
6+
LDFLAGS=-static -nostdlib -fno-builtin -s -lgdi32 -Wl,-subsystem,windows,--gc-sections $(LIBS)
67
ARCH=32
78
ifeq ($(ARCH), 64)
89
WINDRES_ARCH=pe-x86-64

virgo.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,12 @@ static void virgo_go_to_desk(Virgo *v, int desk)
274274
trayicon_set(&v->trayicon, v->current+1);
275275
}
276276

277+
#ifdef RELEASE
278+
int main(void) asm("main");
279+
int main(void)
280+
#else
277281
int main(int argc, char **argv)
282+
#endif
278283
{
279284
Virgo v;
280285
MSG msg;

0 commit comments

Comments
 (0)