Fixed order of TARGET_LFLAGS in the command lines of rules for kernel-mode targets
[reactos.git] / reactos / tools / helper.mk
index 33979c6..453f49e 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: helper.mk,v 1.10 2002/01/08 00:49:02 dwelch Exp $
+# $Id: helper.mk,v 1.12 2002/04/29 23:02:12 hyperion Exp $
 #
 # Helper makefile for ReactOS modules
 # Variables this makefile accepts:
@@ -6,7 +6,7 @@
 #                        program = User mode program
 #                        proglib = Executable program that have exported functions
 #                        dynlink = Dynamic Link Library (DLL)
-#                        library = Import library that will be linked with other code
+#                        library = Library that will be linked with other code
 #                        driver_library = Import library for a driver
 #                        driver = Kernel mode driver
 #                        export_driver = Kernel mode driver that have exported functions
@@ -125,8 +125,8 @@ endif
 endif
 
 ifeq ($(TARGET_TYPE),library)
-  MK_MODE := user
-  MK_EXETYPE := dll
+  MK_MODE := static
+  MK_EXETYPE :=
   MK_DEFEXT := .a
   MK_DEFENTRY :=
   MK_DDKLIBS :=
@@ -135,12 +135,12 @@ ifeq ($(TARGET_TYPE),library)
   MK_CPPFLAGS := -I./ -I$(SDK_PATH_INC)
   MK_RCFLAGS := --include-dir $(SDK_PATH_INC)
   MK_IMPLIB := no
-  MK_IMPLIBONLY := yes
-  MK_IMPLIBDEFPATH := $(SDK_PATH_LIB)
-  MK_IMPLIB_EXT := .a
+  MK_IMPLIBONLY := no
+  MK_IMPLIBDEFPATH :=
+  MK_IMPLIB_EXT :=
   MK_INSTALLDIR := $(SDK_PATH_INC)
   MK_DISTDIR := # FIXME
-  MK_RES_BASE := 
+  MK_RES_BASE :=
 endif
 
 ifeq ($(TARGET_TYPE),driver_library)
@@ -482,13 +482,14 @@ $(MK_NOSTRIPNAME): $(MK_FULLRES) $(TARGET_OBJECTS) $(MK_LIBS)
                --base-file base.tmp \
                --output-exp temp.exp $(MK_EXTRACMD)
        - $(RM) base.tmp
-       $(CC) $(TARGET_LFLAGS) \
+       $(CC) \
                -Wl,--subsystem,native \
                -Wl,--image-base,$(TARGET_BASE) \
                -Wl,--file-alignment,0x1000 \
                -Wl,--section-alignment,0x1000 \
                -Wl,--entry,$(TARGET_ENTRY) \
                -Wl,temp.exp \
+               $(TARGET_LFLAGS) \
                -mdll -nostartfiles -nostdlib \
                -o $(MK_NOSTRIPNAME) \
          $(MK_FULLRES) $(MK_OBJECTS) $(MK_LIBS) $(MK_GCCLIBS)
@@ -509,13 +510,14 @@ $(MK_FULLNAME): $(MK_FULLRES) $(TARGET_OBJECTS) $(MK_LIBS)
                --base-file base.tmp \
                --output-exp temp.exp $(MK_EXTRACMD)
        - $(RM) base.tmp
-       $(CC) $(TARGET_LFLAGS) \
+       $(CC) \
                -Wl,--subsystem,native \
                -Wl,--image-base,$(TARGET_BASE) \
                -Wl,--file-alignment,0x1000 \
                -Wl,--section-alignment,0x1000 \
                -Wl,--entry,$(TARGET_ENTRY) \
                -Wl,temp.exp \
+               $(TARGET_LFLAGS) \
                -mdll -nostartfiles -nostdlib \
                -o $(MK_FULLNAME) \
          $(MK_FULLRES) $(MK_STRIPPED_OBJECT) $(MK_LIBS) $(MK_GCCLIBS)
@@ -523,6 +525,18 @@ $(MK_FULLNAME): $(MK_FULLRES) $(TARGET_OBJECTS) $(MK_LIBS)
 
 endif # MK_MODE
 
+# Static library target
+ifeq ($(MK_MODE),static)
+
+$(MK_NOSTRIPNAME): $(TARGET_OBJECTS)
+       $(AR) -r $(MK_NOSTRIPNAME) $(TARGET_OBJECTS)
+
+# FIXME: dummy rule
+$(MK_FULLNAME): $(MK_NOSTRIPNAME)
+        $(CP) $(MK_NOSTRIPNAME) $(MK_FULLNAME)
+
+endif # MK_MODE
+
 endif # MK_IMPLIBONLY