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))) |
| 16 include $(makedir)/gnu.mk |
| 17 |
| 18 ifeq ($(BOARD),) |
| 19 TARGET = $(shell uname -m) |
| 20 else |
| 21 TARGET = $(BOARD) |
| 22 endif |
| 23 |
15 LIBS += -lrt -lm -lpthread -lncurses | 24 LIBS += -lrt -lm -lpthread -lncurses |
16 INC += -I. | 25 INC += -I. |
17 | 26 |
18 makedir := $(dir $(lastword $(MAKEFILE_LIST))) | 27 name := $(PN) #$(basename $(notdir $(PWD))) |
19 name := $(basename $(notdir $(PWD))) | |
20 target := $(shell uname -m) | 28 target := $(shell uname -m) |
21 objdir :=.$(target) | 29 objdir :=.$(target) |
22 sources := $(wildcard *.c) | 30 sources := $(wildcard *.c) |
23 objects := $(addprefix $(objdir)/, $(sources:.c=.o)) | 31 objects := $(addprefix $(objdir)/, $(sources:.c=.o)) |
24 opus := $(objdir)/$(name) | 32 opus := $(objdir)/$(name) |
25 bin ?= ~/playbin | 33 bin = $(DESTDIR)$(sbindir) |
26 | 34 |
27 # -E stop after preprocessor | 35 # -E stop after preprocessor |
28 # -pg -O -g -DUNOPT -DNDEBUG | 36 # -pg -O -g -DUNOPT -DNDEBUG |
29 # CFLAGS+=-g -O -Wall -Wstrict-prototypes -Werror | 37 # CFLAGS+=-g -O -Wall -Wstrict-prototypes -Werror |
30 CFLAGS+=-g -Wall -Wstrict-prototypes -Werror \ | 38 CFLAGS+=-g -Wall -Wstrict-prototypes -Werror \ |
31 -D_F=\"$(basename $(notdir $(<)))\" \ | 39 -D_F=\"$(basename $(notdir $(<)))\" \ |
32 -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 \ | 40 -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 \ |
33 $(.INCLUDES) $(INC) \ | 41 $(.INCLUDES) $(INC) \ |
34 | 42 |
| 43 DESTDIR ?= $(bin) |
| 44 |
35 $(objdir)/%.o : %.c Makefile | 45 $(objdir)/%.o : %.c Makefile |
36 @ mkdir -p $(objdir) | 46 @ mkdir -p $(objdir) |
37 $(CC) $(CFLAGS) -c $< -o $@ | 47 $(CC) $(CFLAGS) -c $< -o $@ |
38 | 48 |
39 $(opus):$(objects) $(LIBS) | 49 $(opus):$(objects) $(LIBS) |
40 $(CC) $(CFLAGS) $(objects) $(LIBS) -o $(opus) | 50 $(CC) $(CFLAGS) $(objects) $(LIBS) -o $(opus) |
41 | 51 |
42 .PHONEY: install clean test | 52 .PHONEY: install clean test |
43 | 53 |
44 install: | 54 install: |
| 55 mkdir -p $(bin) |
45 cp $(opus) $(bin) | 56 cp $(opus) $(bin) |
46 | 57 |
47 clean: | 58 clean: |
48 @rm -fr $(objdir) | 59 @rm -fr $(objdir) |
49 @rm -f *.core | 60 @rm -f *.core |
50 @rm -f *.out | 61 @rm -f *.out |
51 @rm -f $(bin)/$(opus) | 62 @rm -f $(bin)/$(opus) |
52 | 63 |
53 test: | 64 test: |
54 @ echo "sources=$(sources)" | 65 @ echo "sources=$(sources)" |
55 @ echo "objects=$(objects)" | 66 @ echo "objects=$(objects)" |
56 @ echo "CFLAGS=$(CFLAGS)" | 67 @ echo "CFLAGS=$(CFLAGS)" |
OLD | NEW |