aboutsummaryrefslogblamecommitdiffstats
path: root/wlp/C/Makefile
blob: 558188880e298375e84c7882ddcc8a2642dd9f56 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11










                  




                                                 


        

                                                                     




                                         
                                                             
                                                     
                                                      



                                      
                                                         
                                                
                                                                           












                                                              
                                                                            
CC=gcc
AR=ar
FLEX=flex
YACC=bison

CCOPTS=-Wall -ansi
CCSHARED=-fPIC
AROPTS=-rs
FLEXOPTS=
YACCOPTS=-d

CPPFLAGS:=$(shell dpkg-buildflags --get CPPFLAGS)
CFLAGS:=$(shell dpkg-buildflags --get CFLAGS)
CXXFLAGS:=$(shell dpkg-buildflags --get CXXFLAGS)
LDFLAGS:=$(shell dpkg-buildflags --get LDFLAGS)

SRCDIR=.
BINDIR=.

DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

OBJFILE=structs.o commands.tab.o lex.yy.o

all: archive bin

# archive file for python module
archive: structs bison flex  macro.h structs.h commands.tab.h
	$(AR) $(AROPTS)  $(BINDIR)/wlp.a $(OBJFILE) \
		/usr/lib/$(DEB_HOST_MULTIARCH)/libfl.a

# binary (executable) file for testing
executable: bin

bin: structs bison flex  macro.h structs.h commands.tab.h
	$(CC) $(CCSHARED) $(CCOPTS) $(OBJFILE) \
		yytest.c /usr/lib/$(DEB_HOST_MULTIARCH)/libfl.a -o ./yytest

flex:
	$(FLEX) $(FLEXOPTS) commands.l
	$(CC) $(CCSHARED) -c lex.yy.c -o lex.yy.o

bison:
	$(YACC) $(YACCOPTS) -d commands.y -b commands
	$(CC) $(CCSHARED) -c commands.tab.c -o commands.tab.o

structs:
	$(CC) $(CCSHARED) $(CCOPTS) -c structs.c -o structs.o 

clean:
	rm -f $(OBJFILE) lex.yy.c commands.tab.h commands.tab.c wlp.a yytest