CFLAGS=-Wall -O3
LIBS=-lm

OS=$(shell uname)

ifeq ($(OS), Linux)
LIBS += -lrt
endif

all: fixembed fixscript.o
	./fixembed -nc classes classes.h classes_script
	./fixembed -nc build build.h build_scripts
	./fixembed -bin common scripts.h common_scripts
	./fixembed -bin bin binaries.h exec_binaries
	gcc $(CFLAGS) -o fixbuild fixbuild.c $(LIBS)
	strip fixbuild

fixembed: fixembed.c fixscript.o
	gcc $(CFLAGS) -o fixembed fixembed.c $(LIBS)

fixscript.o: fixscript.c fixscript.h
	gcc $(CFLAGS) -o fixscript.o -c fixscript.c
