| OLD | NEW |
| 1 # | 1 # |
| 2 ############################################################################ | 2 ############################################################################ |
| 3 # (C) Copyright 2008 Novell, Inc. All Rights Reserved. | 3 # (C) Copyright 2008 Novell, Inc. All Rights Reserved. |
| 4 # | 4 # |
| 5 # GPLv2: This program is free software; you can redistribute it | 5 # GPLv2: This program is free software; you can redistribute it |
| 6 # and/or modify it under the terms of version 2 of the GNU General | 6 # and/or modify it under the terms of version 2 of the GNU General |
| 7 # Public License as published by the Free Software Foundation. | 7 # Public License as published by the Free Software Foundation. |
| 8 # | 8 # |
| 9 # This program is distributed in the hope that it will be useful, | 9 # This program is distributed in the hope that it will be useful, |
| 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 # GNU General Public License for more details. | 12 # GNU General Public License for more details. |
| 13 ############################################################################ | 13 ############################################################################ |
| 14 | 14 |
| 15 makedir := $(dir $(lastword $(MAKEFILE_LIST))) | 15 makedir := $(dir $(lastword $(MAKEFILE_LIST))) |
| 16 include $(makedir)/gnu.mk | 16 include $(makedir)/gnu.mk |
| 17 | 17 |
| 18 ifeq ($(BOARD),) | 18 ifeq ($(BOARD),) |
| 19 TARGET = $(shell uname -m) | 19 TARGET = $(shell uname -m) |
| 20 else | 20 else |
| 21 TARGET = $(BOARD) | 21 TARGET = $(BOARD) |
| 22 endif | 22 endif |
| 23 | 23 |
| 24 LIBS += -lrt -lm -lpthread -lncurses | 24 LIBS += -lrt -lm -lpthread -lncurses |
| 25 INC += -I. | 25 INC += -I. |
| 26 | 26 |
| 27 name := $(PN) #$(basename $(notdir $(PWD))) | 27 name := $(basename $(notdir $(PWD))) |
| 28 target := $(shell uname -m) | 28 target := $(shell uname -m) |
| 29 objdir :=.$(target) | 29 objdir :=.$(target) |
| 30 sources := $(wildcard *.c) | 30 sources := $(wildcard *.c) |
| 31 objects := $(addprefix $(objdir)/, $(sources:.c=.o)) | 31 objects := $(addprefix $(objdir)/, $(sources:.c=.o)) |
| 32 opus := $(objdir)/$(name) | 32 opus := $(objdir)/$(name) |
| 33 bin = $(DESTDIR)$(sbindir) | 33 bin = $(DESTDIR)$(sbindir) |
| 34 | 34 |
| 35 # -E stop after preprocessor | 35 # -E stop after preprocessor |
| 36 # -pg -O -g -DUNOPT -DNDEBUG | 36 # -pg -O -g -DUNOPT -DNDEBUG |
| 37 # CFLAGS+=-g -O -Wall -Wstrict-prototypes -Werror | 37 # CFLAGS+=-g -O -Wall -Wstrict-prototypes -Werror |
| 38 CFLAGS+=-g -Wall -Wstrict-prototypes -Werror \ | 38 CFLAGS+=-g -Wall -Wstrict-prototypes -Werror \ |
| 39 -D_F=\"$(basename $(notdir $(<)))\" \ | 39 -D_F=\"$(basename $(notdir $(<)))\" \ |
| 40 -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 \ | 40 -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 \ |
| 41 $(.INCLUDES) $(INC) \ | 41 $(.INCLUDES) $(INC) \ |
| 42 | 42 |
| 43 DESTDIR ?= $(bin) | |
| 44 | |
| 45 $(objdir)/%.o : %.c Makefile | 43 $(objdir)/%.o : %.c Makefile |
| 46 @ mkdir -p $(objdir) | 44 @ mkdir -p $(objdir) |
| 47 $(CC) $(CFLAGS) -c $< -o $@ | 45 $(CC) $(CFLAGS) -c $< -o $@ |
| 48 | 46 |
| 49 $(opus):$(objects) $(LIBS) | 47 $(opus):$(objects) $(LIBS) |
| 50 $(CC) $(CFLAGS) $(objects) $(LIBS) -o $(opus) | 48 $(CC) $(CFLAGS) $(objects) $(LIBS) -o $(opus) |
| 51 | 49 |
| 52 .PHONEY: install clean test | 50 .PHONEY: install clean test |
| 53 | 51 |
| 54 install: | 52 install: |
| 55 mkdir -p $(bin) | 53 mkdir -p $(bin) |
| 56 cp $(opus) $(bin) | 54 cp $(opus) $(bin) |
| 57 | 55 |
| 58 clean: | 56 clean: |
| 59 @rm -fr $(objdir) | 57 @rm -fr $(objdir) |
| 60 @rm -f *.core | 58 @rm -f *.core |
| 61 @rm -f *.out | 59 @rm -f *.out |
| 62 @rm -f $(bin)/$(opus) | 60 @rm -f $(bin)/$(opus) |
| 63 | 61 |
| 64 test: | 62 test: |
| 63 @ echo "Test" |
| 65 @ echo "sources=$(sources)" | 64 @ echo "sources=$(sources)" |
| 66 @ echo "objects=$(objects)" | 65 @ echo "objects=$(objects)" |
| 67 @ echo "CFLAGS=$(CFLAGS)" | 66 @ echo "CFLAGS=$(CFLAGS)" |
| 67 @ echo "bin=$(bin)" |
| 68 @ echo "objdir=$(objdir)" |
| 69 @ echo "opus=$(opus)" |
| 70 @ echo "name=$(name)" |
| OLD | NEW |