Imported Upstream version 0.4.8
[platform/upstream/libsmi.git] / win / GNUmakefile
1 #
2 # GNUmakefile --
3 #
4 #       GNU Makefile for w32 VC++ environment.
5
6 # Copyright (c) 2000-2005 Yigal Hochberg, DMH Software.
7 # Copyright (c) 2000 E. Schoenfelder, Gaertner Datensysteme Braunschweig.
8 # Copyright (c) 2000 J. Schoenwaelder, Technical University of Braunschweig.
9 #
10 # See the file "COPYING" for information on usage and redistribution
11 # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
12 #
13 # @(#) $Id: GNUmakefile 2409 2005-05-30 13:14:21Z strauss $
14
15 ##
16 ## Project directories -- these may need to be customized for your site
17 ##
18 ## ROOT --      top of the source tree.
19 ## TMPDIR --    location for .obj files.
20 ## TOOLS32 --   location of VC++ compiler installation.
21 ##
22 ROOT    = ./..
23 TMPDIR  = .
24 TOOLS32 = C:\PROGRA~1\MICROS~2\VC98
25
26 ##
27 ## Installation paths: 
28 ##
29 ## MIBROOT  -- definition for default search path (unix-style)
30 ## MIBDIR   -- same in windows style
31 ## BINDIR   -- destination for the binaries (smidump.exe, ...)
32 ## LIBDIR   -- destination for the library (smi.lib)
33 ##
34 MIBROOT = c:/smi/mibs
35 INSTROOT = c:\smi
36 MIBDIR = $(INSTROOT)\mibs
37 BINDIR = $(INSTROOT)\bin
38 LIBDIR = $(INSTROOT)\lib
39
40 ##
41 ## This include is for smidump_SOURCES definition.
42 ##
43 include ../tools/Makefile.am
44
45 ##
46 ## Visual C++ tools
47 ##
48 PATH := $(TOOLS32)\bin;$(PATH)
49
50 cc32    = cl
51 implib  = lib
52 CC      = $(cc32)
53 CFLAGS  = -nologo -W3 -DYY_NO_UNISTD_H
54 CC_INCL = #-I$(TOOLS32)/include
55 AR      = $(implib)
56 ARFLAGS = -nologo
57 CP      = copy
58 RM      = del
59 MKDIR   = md
60
61 ##
62 ## Definitions:
63 ##
64 #DEBUG = -W3 -Zi -Od /Yd
65 INCLUDES = -I$(ROOT)/lib -I$(ROOT)/win $(CC_INCL)
66 DEFINES = $(DEBUG)
67
68 ##
69 ## Library objects
70 ##
71 LIBSMIOBJS = $(patsubst %.c, %.obj, $(notdir $(wildcard ../lib/*.c))) win.obj \
72              shhopt.obj
73
74 ##
75 ## Tool objects
76 ##
77 SMIQUERYOBJS = smiquery.obj
78 SMILINTOBJS  = smilint.obj
79 SMIDUMPOBJS  = $(filter-out %.h, $(smidump_SOURCES:.c=.obj))
80
81 ##
82 ## Targets
83 ##
84 all:            libs tools
85
86 libs:           smi.lib
87 tools:          smiquery.exe smilint.exe smidump.exe
88
89 smi.lib:        $(LIBSMIOBJS)
90 smiquery.exe:   $(SMIQUERYOBJS) smi.lib
91 smilint.exe:    $(SMILINTOBJS) smi.lib
92 smidump.exe:    $(SMIDUMPOBJS) smi.lib
93
94 clean:
95         del *.lib
96         del *.obj
97         del *.exe
98         del *.ilk
99         del *.pdb
100         del *.mdp
101
102 install:        all install-doc install-bin install-lib install-mibs
103
104 install-doc:
105         $(MKDIR) $(INSTROOT)
106         $(CP) ..\README $(INSTROOT)
107         $(CP) ..\COPYING $(INSTROOT)
108         $(CP) README.win $(INSTROOT)
109         $(MKDIR) $(INSTROOT)\doc
110         $(CP) ..\doc\*.txt $(INSTROOT)\doc
111         $(CP) ..\doc\*.ps $(INSTROOT)\doc
112
113 install-bin:
114         $(MKDIR) $(BINDIR)
115         $(CP) *.exe $(BINDIR)
116
117 install-lib:
118         $(MKDIR) $(LIBDIR)
119         $(CP) *.lib $(LIBDIR)
120
121 install-mibs:
122         $(MKDIR) $(MIBDIR)
123         $(MKDIR) $(MIBDIR)\iana
124         $(CP) ..\mibs\iana\*.* $(MIBDIR)\iana
125         $(MKDIR) $(MIBDIR)\ietf
126         $(CP) ..\mibs\ietf\*.* $(MIBDIR)\ietf
127         $(MKDIR) $(MIBDIR)\irtf
128         $(CP) ..\mibs\irtf\*.* $(MIBDIR)\irtf
129         $(MKDIR) $(MIBDIR)\tubs
130         $(CP) ..\mibs\tubs\*.* $(MIBDIR)\tubs
131         $(MKDIR) $(MIBDIR)\site
132
133 ##
134 ## Generic rules
135 ##
136 vpath %.c ../lib
137 vpath %.c ../tools
138
139 %.obj : %.c
140         $(CC) $(CFLAGS) -c $(INCLUDES) $(DEFINES) -Fo$@ $<
141
142 %.exe :
143         $(CC) $(CFLAGS) $(DEFINES) -o $(notdir $@) $^
144
145 %.lib :
146         $(AR) $(ARFLAGS) -out:$(notdir $@) $^ 
147
148 ##
149 ## Special compilation rules for scanner files
150 ##
151 scanner-objs = scanner-smi.obj scanner-sming.obj
152
153 $(scanner-objs) : %.obj : %.c
154         $(CC) -c $(CFLAGS) -D__STDC__ $(INCLUDES) $(DEFINES) -Fo$@ $<
155