Skip to content

Commit

Permalink
halved binary size by using nostdlib
Browse files Browse the repository at this point in the history
  • Loading branch information
henkman committed Feb 9, 2015
1 parent cb91e06 commit e602739
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@

SRCS=virgo.c
OBJS=$(SRCS:.c=.o)
CFLAGS=-O2 -std=c99 -Wall -fno-ident -ffunction-sections -fdata-sections
LDFLAGS=-static -s -lgdi32 -Wl,-subsystem,windows,--gc-sections
CFLAGS=-O2 -nostdlib -Wall -fno-ident -ffunction-sections -fdata-sections -DRELEASE=1
LIBS=-luser32 -lshell32 -lmsvcrt -lkernel32
LDFLAGS=-static -nostdlib -fno-builtin -s -lgdi32 -Wl,-subsystem,windows,--gc-sections $(LIBS)
ARCH=32
ifeq ($(ARCH), 64)
WINDRES_ARCH=pe-x86-64
Expand Down
5 changes: 5 additions & 0 deletions virgo.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,12 @@ static void virgo_go_to_desk(Virgo *v, int desk)
trayicon_set(&v->trayicon, v->current+1);
}

#ifdef RELEASE
int main(void) asm("main");
int main(void)
#else
int main(int argc, char **argv)
#endif
{
Virgo v;
MSG msg;
Expand Down

0 comments on commit e602739

Please sign in to comment.