blob: 23ae9d6dc2cba471dcc1f7e4ea75096b270478da [file] [log] [blame]
#
############################################################################
# (C) Copyright 2008 Novell, Inc. All Rights Reserved.
#
# GPLv2: This program is free software; you can redistribute it
# and/or modify it under the terms of version 2 of the GNU General
# Public License as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
############################################################################
makedir := $(dir $(lastword $(MAKEFILE_LIST)))
include $(makedir)/gnu.mk
ifeq ($(BOARD),)
TARGET = $(shell uname -m)
else
TARGET = $(BOARD)
endif
LIBS += -lrt -lm -lpthread -lncurses
INC += -I.
ifeq ($(PN),)
name := $(basename $(notdir $(PWD)))
else
name := $(PN)
endif
target := $(shell uname -m)
objdir :=.$(target)
sources := $(wildcard *.c)
objects := $(addprefix $(objdir)/, $(sources:.c=.o))
opus := $(objdir)/$(name)
bin = $(DESTDIR)$(sbindir)
# -E stop after preprocessor
# -pg -O -g -DUNOPT -DNDEBUG
# CFLAGS+=-g -O -Wall -Wstrict-prototypes -Werror
CFLAGS+=-g -Wall -Wstrict-prototypes -Werror \
-D_F=\"$(basename $(notdir $(<)))\" \
-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 \
$(.INCLUDES) $(INC) \
$(objdir)/%.o : %.c Makefile
@ mkdir -p $(objdir)
$(CC) $(CFLAGS) -c $< -o $@
$(opus):$(objects) $(LIBS)
$(CC) $(CFLAGS) $(objects) $(LIBS) -o $(opus)
.PHONEY: install clean test
install:
mkdir -p $(bin)
cp $(opus) $(bin)
clean:
@rm -fr $(objdir)
@rm -f *.core
@rm -f *.out
@rm -f $(bin)/$(opus)
test:
@ echo "Test"
@ echo "sources=$(sources)"
@ echo "objects=$(objects)"
@ echo "CFLAGS=$(CFLAGS)"
@ echo "BOARD=$(BOARD)"
@ echo "bin=$(bin)"
@ echo "objdir=$(objdir)"
@ echo "opus=$(opus)"
@ echo "name=$(name)"