# Copyright (C) JAEHYUK CHO
# All rights reserved.
# Code by JaeHyuk Cho <mailto:minzkn@minzkn.com>

CROSS_COMPILE                ?=#

CC                           :=$(CROSS_COMPILE)gcc#
LD                           :=$(CROSS_COMPILE)ld#
RM                           :=rm -f#
STRIP                        :=$(CROSS_COMPILE)strip#

THIS_NAME                    :=mzping#

#CFLAGS                       :=-Os -pipe -Wall -Werror -ansi -fomit-frame-pointer -fPIC -I.#
CFLAGS                       :=-Os -pipe -Wall -ansi -fomit-frame-pointer -fPIC -I.#
#CFLAGS                       :=-Os -pipe -Wall -Werror -fomit-frame-pointer -fPIC -I.#
CFLAGS                       +=-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0#

LDFLAGS                      :=-s#
STRIPFLAGS                   :=--remove-section=.comment --remove-section=.note#

TARGET_bin                   :=$(THIS_NAME)#
TARGET                       :=$(TARGET_bin)#

OBJECTS_bin                  := mzping.o#
OBJECTS                      := $(OBJECTS_bin)#

DEPEND                       := Makefile#

.PHONY: all clean

all: $(TARGET)
clean: ; $(RM) *.o $(TARGET)

$(TARGET_bin): $(OBJECTS_bin)
	$(CC) $(LDFLAGS) -o $(@) $(^)
	$(STRIP) $(STRIPFLAGS) $(@)
$(OBJECTS): $(DEPEND)

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

# End of Makefile
